Aufgabe_4, Aufgabe_5, Aufgabe_6

This commit is contained in:
WickedJack99
2024-01-13 09:46:15 +01:00
parent 7dee7d0eb2
commit e5432cb30d
199 changed files with 5356 additions and 0 deletions

BIN
Aufgabe_5/05-monads.pdf Normal file

Binary file not shown.

BIN
Aufgabe_5/blatt-05.pdf Normal file

Binary file not shown.

BIN
Aufgabe_5/code(1).zip Normal file

Binary file not shown.

31
Aufgabe_5/code/.hlint.yaml Executable file
View File

@@ -0,0 +1,31 @@
# HLint configuration file
# https://github.com/ndmitchell/hlint
# Ignore some builtin hints
- ignore: {name: "Avoid lambda using `infix`"}
- ignore: {name: "Avoid lambda"}
- ignore: {name: "Eta reduce"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Reduce duplication" }
- ignore: {name: "Redundant $!" }
- ignore: {name: "Redundant bracket"}
- ignore: {name: "Redundant do"}
- ignore: {name: "Redundant pure"}
- ignore: {name: "Redundant return"}
- ignore: {name: "Replace case with maybe"}
- ignore: {name: "Use $>" }
- ignore: {name: "Use <$>"}
- ignore: {name: "Use camelCase" }
- ignore: {name: "Use const"}
- ignore: {name: "Use fmap" }
- ignore: {name: "Use foldr"}
- ignore: {name: "Use guards"}
- ignore: {name: "Use if"}
- ignore: {name: "Use list comprehension"}
- ignore: {name: "Use maybe"}
- ignore: {name: "Use newtype instead of data"}
- ignore: {name: "Use notElem"}
- ignore: {name: "Use second" }
- ignore: {name: "Use section" }
- ignore: {name: "Use tuple-section"}
- ignore: {name: "Use uncurry" }

View File

@@ -0,0 +1,74 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -w #-}
module Paths_ap05 (
version,
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
getDataFileName, getSysconfDir
) where
import qualified Control.Exception as Exception
import qualified Data.List as List
import Data.Version (Version(..))
import System.Environment (getEnv)
import Prelude
#if defined(VERSION_base)
#if MIN_VERSION_base(4,0,0)
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#else
catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
#endif
#else
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#endif
catchIO = Exception.catch
version :: Version
version = Version [0,1] []
getDataFileName :: FilePath -> IO FilePath
getDataFileName name = do
dir <- getDataDir
return (dir `joinFileName` name)
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
bindir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/bin"
libdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/lib/x86_64-linux-ghc-9.4.7/ap05-0.1-1WN5bfNZMxCBk9rV3xcl3T-ex01"
dynlibdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/lib/x86_64-linux-ghc-9.4.7"
datadir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/share/x86_64-linux-ghc-9.4.7/ap05-0.1"
libexecdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/libexec/x86_64-linux-ghc-9.4.7/ap05-0.1"
sysconfdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/etc"
getBinDir = catchIO (getEnv "ap05_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "ap05_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "ap05_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "ap05_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "ap05_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "ap05_sysconfdir") (\_ -> return sysconfdir)
joinFileName :: String -> String -> FilePath
joinFileName "" fname = fname
joinFileName "." fname = fname
joinFileName dir "" = dir
joinFileName dir fname
| isPathSeparator (List.last dir) = dir ++ fname
| otherwise = dir ++ pathSeparator : fname
pathSeparator :: Char
pathSeparator = '/'
isPathSeparator :: Char -> Bool
isPathSeparator c = c == '/'

View File

@@ -0,0 +1,170 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package ap05-0.1 */
#ifndef VERSION_ap05
#define VERSION_ap05 "0.1"
#endif /* VERSION_ap05 */
#ifndef MIN_VERSION_ap05
#define MIN_VERSION_ap05(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 1 || \
(major1) == 0 && (major2) == 1 && (minor) <= 0)
#endif /* MIN_VERSION_ap05 */
/* package HUnit-1.6.2.0 */
#ifndef VERSION_HUnit
#define VERSION_HUnit "1.6.2.0"
#endif /* VERSION_HUnit */
#ifndef MIN_VERSION_HUnit
#define MIN_VERSION_HUnit(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 6 || \
(major1) == 1 && (major2) == 6 && (minor) <= 2)
#endif /* MIN_VERSION_HUnit */
/* package base-4.17.2.0 */
#ifndef VERSION_base
#define VERSION_base "4.17.2.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 17 || \
(major1) == 4 && (major2) == 17 && (minor) <= 2)
#endif /* MIN_VERSION_base */
/* package mtl-2.2.2 */
#ifndef VERSION_mtl
#define VERSION_mtl "2.2.2"
#endif /* VERSION_mtl */
#ifndef MIN_VERSION_mtl
#define MIN_VERSION_mtl(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 2 || \
(major1) == 2 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_VERSION_mtl */
/* package text-2.0.2 */
#ifndef VERSION_text
#define VERSION_text "2.0.2"
#endif /* VERSION_text */
#ifndef MIN_VERSION_text
#define MIN_VERSION_text(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 0 || \
(major1) == 2 && (major2) == 0 && (minor) <= 2)
#endif /* MIN_VERSION_text */
/* tool alex-3.2.5 */
#ifndef TOOL_VERSION_alex
#define TOOL_VERSION_alex "3.2.5"
#endif /* TOOL_VERSION_alex */
#ifndef MIN_TOOL_VERSION_alex
#define MIN_TOOL_VERSION_alex(major1,major2,minor) (\
(major1) < 3 || \
(major1) == 3 && (major2) < 2 || \
(major1) == 3 && (major2) == 2 && (minor) <= 5)
#endif /* MIN_TOOL_VERSION_alex */
/* tool gcc-11 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "11"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 11 || \
(major1) == 11 && (major2) < 0 || \
(major1) == 11 && (major2) == 0 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-9.4.7 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "9.4.7"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-9.4.7 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "9.4.7"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.27.0 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.27.0"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 27 || \
(major1) == 2 && (major2) == 27 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool happy-1.19.12 */
#ifndef TOOL_VERSION_happy
#define TOOL_VERSION_happy "1.19.12"
#endif /* TOOL_VERSION_happy */
#ifndef MIN_TOOL_VERSION_happy
#define MIN_TOOL_VERSION_happy(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 19 || \
(major1) == 1 && (major2) == 19 && (minor) <= 12)
#endif /* MIN_TOOL_VERSION_happy */
/* tool hpc-0.68 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.68"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.8 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.8"
#endif /* TOOL_VERSION_hsc2hs */
#ifndef MIN_TOOL_VERSION_hsc2hs
#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool hscolour-1.24 */
#ifndef TOOL_VERSION_hscolour
#define TOOL_VERSION_hscolour "1.24"
#endif /* TOOL_VERSION_hscolour */
#ifndef MIN_TOOL_VERSION_hscolour
#define MIN_TOOL_VERSION_hscolour(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 24 || \
(major1) == 1 && (major2) == 24 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hscolour */
/* tool runghc-9.4.7 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "9.4.7"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.38 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.38"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 38 || \
(major1) == 2 && (major2) == 38 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "ap05-0.1-1WN5bfNZMxCBk9rV3xcl3T-ex01"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.1"
#endif /* CURRENT_PACKAGE_VERSION */

View File

@@ -0,0 +1,74 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -w #-}
module Paths_ap05 (
version,
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
getDataFileName, getSysconfDir
) where
import qualified Control.Exception as Exception
import qualified Data.List as List
import Data.Version (Version(..))
import System.Environment (getEnv)
import Prelude
#if defined(VERSION_base)
#if MIN_VERSION_base(4,0,0)
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#else
catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
#endif
#else
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#endif
catchIO = Exception.catch
version :: Version
version = Version [0,1] []
getDataFileName :: FilePath -> IO FilePath
getDataFileName name = do
dir <- getDataDir
return (dir `joinFileName` name)
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
bindir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/bin"
libdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/lib/x86_64-linux-ghc-9.4.7/ap05-0.1-95SecnZIX6WJ1hjkoNBMel-ex02"
dynlibdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/lib/x86_64-linux-ghc-9.4.7"
datadir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/share/x86_64-linux-ghc-9.4.7/ap05-0.1"
libexecdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/libexec/x86_64-linux-ghc-9.4.7/ap05-0.1"
sysconfdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/etc"
getBinDir = catchIO (getEnv "ap05_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "ap05_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "ap05_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "ap05_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "ap05_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "ap05_sysconfdir") (\_ -> return sysconfdir)
joinFileName :: String -> String -> FilePath
joinFileName "" fname = fname
joinFileName "." fname = fname
joinFileName dir "" = dir
joinFileName dir fname
| isPathSeparator (List.last dir) = dir ++ fname
| otherwise = dir ++ pathSeparator : fname
pathSeparator :: Char
pathSeparator = '/'
isPathSeparator :: Char -> Bool
isPathSeparator c = c == '/'

View File

@@ -0,0 +1,170 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package ap05-0.1 */
#ifndef VERSION_ap05
#define VERSION_ap05 "0.1"
#endif /* VERSION_ap05 */
#ifndef MIN_VERSION_ap05
#define MIN_VERSION_ap05(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 1 || \
(major1) == 0 && (major2) == 1 && (minor) <= 0)
#endif /* MIN_VERSION_ap05 */
/* package HUnit-1.6.2.0 */
#ifndef VERSION_HUnit
#define VERSION_HUnit "1.6.2.0"
#endif /* VERSION_HUnit */
#ifndef MIN_VERSION_HUnit
#define MIN_VERSION_HUnit(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 6 || \
(major1) == 1 && (major2) == 6 && (minor) <= 2)
#endif /* MIN_VERSION_HUnit */
/* package base-4.17.2.0 */
#ifndef VERSION_base
#define VERSION_base "4.17.2.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 17 || \
(major1) == 4 && (major2) == 17 && (minor) <= 2)
#endif /* MIN_VERSION_base */
/* package mtl-2.2.2 */
#ifndef VERSION_mtl
#define VERSION_mtl "2.2.2"
#endif /* VERSION_mtl */
#ifndef MIN_VERSION_mtl
#define MIN_VERSION_mtl(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 2 || \
(major1) == 2 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_VERSION_mtl */
/* package text-2.0.2 */
#ifndef VERSION_text
#define VERSION_text "2.0.2"
#endif /* VERSION_text */
#ifndef MIN_VERSION_text
#define MIN_VERSION_text(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 0 || \
(major1) == 2 && (major2) == 0 && (minor) <= 2)
#endif /* MIN_VERSION_text */
/* tool alex-3.2.5 */
#ifndef TOOL_VERSION_alex
#define TOOL_VERSION_alex "3.2.5"
#endif /* TOOL_VERSION_alex */
#ifndef MIN_TOOL_VERSION_alex
#define MIN_TOOL_VERSION_alex(major1,major2,minor) (\
(major1) < 3 || \
(major1) == 3 && (major2) < 2 || \
(major1) == 3 && (major2) == 2 && (minor) <= 5)
#endif /* MIN_TOOL_VERSION_alex */
/* tool gcc-11 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "11"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 11 || \
(major1) == 11 && (major2) < 0 || \
(major1) == 11 && (major2) == 0 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-9.4.7 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "9.4.7"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-9.4.7 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "9.4.7"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.27.0 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.27.0"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 27 || \
(major1) == 2 && (major2) == 27 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool happy-1.19.12 */
#ifndef TOOL_VERSION_happy
#define TOOL_VERSION_happy "1.19.12"
#endif /* TOOL_VERSION_happy */
#ifndef MIN_TOOL_VERSION_happy
#define MIN_TOOL_VERSION_happy(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 19 || \
(major1) == 1 && (major2) == 19 && (minor) <= 12)
#endif /* MIN_TOOL_VERSION_happy */
/* tool hpc-0.68 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.68"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.8 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.8"
#endif /* TOOL_VERSION_hsc2hs */
#ifndef MIN_TOOL_VERSION_hsc2hs
#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool hscolour-1.24 */
#ifndef TOOL_VERSION_hscolour
#define TOOL_VERSION_hscolour "1.24"
#endif /* TOOL_VERSION_hscolour */
#ifndef MIN_TOOL_VERSION_hscolour
#define MIN_TOOL_VERSION_hscolour(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 24 || \
(major1) == 1 && (major2) == 24 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hscolour */
/* tool runghc-9.4.7 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "9.4.7"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.38 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.38"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 38 || \
(major1) == 2 && (major2) == 38 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "ap05-0.1-95SecnZIX6WJ1hjkoNBMel-ex02"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.1"
#endif /* CURRENT_PACKAGE_VERSION */

View File

@@ -0,0 +1,74 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -w #-}
module Paths_ap05 (
version,
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
getDataFileName, getSysconfDir
) where
import qualified Control.Exception as Exception
import qualified Data.List as List
import Data.Version (Version(..))
import System.Environment (getEnv)
import Prelude
#if defined(VERSION_base)
#if MIN_VERSION_base(4,0,0)
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#else
catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
#endif
#else
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#endif
catchIO = Exception.catch
version :: Version
version = Version [0,1] []
getDataFileName :: FilePath -> IO FilePath
getDataFileName name = do
dir <- getDataDir
return (dir `joinFileName` name)
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
bindir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/bin"
libdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/lib/x86_64-linux-ghc-9.4.7/ap05-0.1-AJuyaSgzdSw4SJrI0SnuWg-ex03"
dynlibdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/lib/x86_64-linux-ghc-9.4.7"
datadir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/share/x86_64-linux-ghc-9.4.7/ap05-0.1"
libexecdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/libexec/x86_64-linux-ghc-9.4.7/ap05-0.1"
sysconfdir = "/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/install/x86_64-linux/c95135353db856bc6efc9bd10e84b1a5a9a219f3607bca4f1889717059c848cc/9.4.7/etc"
getBinDir = catchIO (getEnv "ap05_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "ap05_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "ap05_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "ap05_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "ap05_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "ap05_sysconfdir") (\_ -> return sysconfdir)
joinFileName :: String -> String -> FilePath
joinFileName "" fname = fname
joinFileName "." fname = fname
joinFileName dir "" = dir
joinFileName dir fname
| isPathSeparator (List.last dir) = dir ++ fname
| otherwise = dir ++ pathSeparator : fname
pathSeparator :: Char
pathSeparator = '/'
isPathSeparator :: Char -> Bool
isPathSeparator c = c == '/'

View File

@@ -0,0 +1,170 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package ap05-0.1 */
#ifndef VERSION_ap05
#define VERSION_ap05 "0.1"
#endif /* VERSION_ap05 */
#ifndef MIN_VERSION_ap05
#define MIN_VERSION_ap05(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 1 || \
(major1) == 0 && (major2) == 1 && (minor) <= 0)
#endif /* MIN_VERSION_ap05 */
/* package HUnit-1.6.2.0 */
#ifndef VERSION_HUnit
#define VERSION_HUnit "1.6.2.0"
#endif /* VERSION_HUnit */
#ifndef MIN_VERSION_HUnit
#define MIN_VERSION_HUnit(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 6 || \
(major1) == 1 && (major2) == 6 && (minor) <= 2)
#endif /* MIN_VERSION_HUnit */
/* package base-4.17.2.0 */
#ifndef VERSION_base
#define VERSION_base "4.17.2.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 17 || \
(major1) == 4 && (major2) == 17 && (minor) <= 2)
#endif /* MIN_VERSION_base */
/* package mtl-2.2.2 */
#ifndef VERSION_mtl
#define VERSION_mtl "2.2.2"
#endif /* VERSION_mtl */
#ifndef MIN_VERSION_mtl
#define MIN_VERSION_mtl(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 2 || \
(major1) == 2 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_VERSION_mtl */
/* package text-2.0.2 */
#ifndef VERSION_text
#define VERSION_text "2.0.2"
#endif /* VERSION_text */
#ifndef MIN_VERSION_text
#define MIN_VERSION_text(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 0 || \
(major1) == 2 && (major2) == 0 && (minor) <= 2)
#endif /* MIN_VERSION_text */
/* tool alex-3.2.5 */
#ifndef TOOL_VERSION_alex
#define TOOL_VERSION_alex "3.2.5"
#endif /* TOOL_VERSION_alex */
#ifndef MIN_TOOL_VERSION_alex
#define MIN_TOOL_VERSION_alex(major1,major2,minor) (\
(major1) < 3 || \
(major1) == 3 && (major2) < 2 || \
(major1) == 3 && (major2) == 2 && (minor) <= 5)
#endif /* MIN_TOOL_VERSION_alex */
/* tool gcc-11 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "11"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 11 || \
(major1) == 11 && (major2) < 0 || \
(major1) == 11 && (major2) == 0 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-9.4.7 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "9.4.7"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-9.4.7 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "9.4.7"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.27.0 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.27.0"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 27 || \
(major1) == 2 && (major2) == 27 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool happy-1.19.12 */
#ifndef TOOL_VERSION_happy
#define TOOL_VERSION_happy "1.19.12"
#endif /* TOOL_VERSION_happy */
#ifndef MIN_TOOL_VERSION_happy
#define MIN_TOOL_VERSION_happy(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 19 || \
(major1) == 1 && (major2) == 19 && (minor) <= 12)
#endif /* MIN_TOOL_VERSION_happy */
/* tool hpc-0.68 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.68"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.8 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.8"
#endif /* TOOL_VERSION_hsc2hs */
#ifndef MIN_TOOL_VERSION_hsc2hs
#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool hscolour-1.24 */
#ifndef TOOL_VERSION_hscolour
#define TOOL_VERSION_hscolour "1.24"
#endif /* TOOL_VERSION_hscolour */
#ifndef MIN_TOOL_VERSION_hscolour
#define MIN_TOOL_VERSION_hscolour(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 24 || \
(major1) == 1 && (major2) == 24 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hscolour */
/* tool runghc-9.4.7 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "9.4.7"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.38 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.38"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 38 || \
(major1) == 2 && (major2) == 38 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "ap05-0.1-AJuyaSgzdSw4SJrI0SnuWg-ex03"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.1"
#endif /* CURRENT_PACKAGE_VERSION */

View File

@@ -0,0 +1,16 @@
/home/student/.ghcup/ghc/9.4.7/lib/ghc-9.4.7/lib/x86_64-linux-ghc-9.4.7/rts-1.0.2/include/ghcversion.h:
hash: ee548d48ca5c94d7c7fab127ec07be47b01afa24d6495358aa9ff6cfc8541c81
? /home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/dist/x86_64-linux/Cabal-3.8.1.0/build/ex01/autogen/Paths_ap05.hs
: hash: ea62a1766305d9d88bc1c20fe7f041291db673338209a94073400a1e6477a20c
? /home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/dist/x86_64-linux/Cabal-3.8.1.0/build/ex01/autogen/cabal_macros.h
: hash: aa7ad43ed234b77ede973e75efadbc79b54a247eb8a5f2858bac7504baba7c42
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/ap05.cabal:
hash: a07b6ceaeb4882a8c1f0acce9358a1bfcd0035462c93d8e9d3dc939f3d7f7f50
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/ex01/Exp.hs:
hash: 95999cd9ea895c25fa8aeb31bd97511f57ce053ccb4d0ae771aa10309a5f1ae2
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/ex01/Main.hs:
hash: 48a50a80e54019a5245ec1b6b6544041d3e2933dc3cab863923a28ce6acab550
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/package.yaml:
hash: 674de3e373c6c79404da40d6c80571b7003ffa06887f7231e6bbe78805c72bec
/usr/include/stdc-predef.h:
hash: cb08cd5d4cc059a90833ac48a284d25016e8d56ded8ad4cd98d8ac59cc5053f3

View File

@@ -0,0 +1,16 @@
/home/student/.ghcup/ghc/9.4.7/lib/ghc-9.4.7/lib/x86_64-linux-ghc-9.4.7/rts-1.0.2/include/ghcversion.h:
hash: ee548d48ca5c94d7c7fab127ec07be47b01afa24d6495358aa9ff6cfc8541c81
? /home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/dist/x86_64-linux/Cabal-3.8.1.0/build/ex02/autogen/Paths_ap05.hs
: hash: 766dbbcb550b3d864eadd2d99498c17e5f5854b3bd29c77ef6c085c9859d030a
? /home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/dist/x86_64-linux/Cabal-3.8.1.0/build/ex02/autogen/cabal_macros.h
: hash: d6d267687b0bb2a89083ca3345303cf461119b190e3ffd16dde105446b793807
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/ap05.cabal:
hash: a07b6ceaeb4882a8c1f0acce9358a1bfcd0035462c93d8e9d3dc939f3d7f7f50
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/ex02/Main.hs:
hash: 5b6c7511e3656092cf4f360106bc7907880c820ad838283fe4cade5dce67933e
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/ex02/Product.hs:
hash: b48f5b9b9e122dc9f11142791d67bd6473c9bd719f72340ab81e2dff7b1b9097
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/package.yaml:
hash: 674de3e373c6c79404da40d6c80571b7003ffa06887f7231e6bbe78805c72bec
/usr/include/stdc-predef.h:
hash: cb08cd5d4cc059a90833ac48a284d25016e8d56ded8ad4cd98d8ac59cc5053f3

View File

@@ -0,0 +1,16 @@
/home/student/.ghcup/ghc/9.4.7/lib/ghc-9.4.7/lib/x86_64-linux-ghc-9.4.7/rts-1.0.2/include/ghcversion.h:
hash: ee548d48ca5c94d7c7fab127ec07be47b01afa24d6495358aa9ff6cfc8541c81
? /home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/dist/x86_64-linux/Cabal-3.8.1.0/build/ex03/autogen/Paths_ap05.hs
: hash: 44ce1aa62f8495e9e9dfff9c523aafbcffaa83cf13346d994768a1844a7ab936
? /home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/.stack-work/dist/x86_64-linux/Cabal-3.8.1.0/build/ex03/autogen/cabal_macros.h
: hash: 867b960dc72510472b1b8dbdb1f770cf5d1d31dbe1453749f0730c93e6aa00e6
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/ap05.cabal:
hash: a07b6ceaeb4882a8c1f0acce9358a1bfcd0035462c93d8e9d3dc939f3d7f7f50
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/ex03/Main.hs:
hash: f2a96b62d2f30f5a0dc67978e48265e92be65e7370af8a1f92ce6fc5fae6b664
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/ex03/Random.hs:
hash: 92851e93732e58f12b94e33c308f5fa92cc31dfa153cb9eb9c68119ed7106d99
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/package.yaml:
hash: 674de3e373c6c79404da40d6c80571b7003ffa06887f7231e6bbe78805c72bec
/usr/include/stdc-predef.h:
hash: cb08cd5d4cc059a90833ac48a284d25016e8d56ded8ad4cd98d8ac59cc5053f3

View File

@@ -0,0 +1 @@
Just used for its modification time

View File

@@ -0,0 +1 @@
/home/student/Documents/Anwendungsentwicklung/Aufgabe_5/code/

View File

@@ -0,0 +1 @@
Just used for its modification time

View File

@@ -0,0 +1 @@
success

View File

@@ -0,0 +1,173 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package ap05-0.1 */
#ifndef VERSION_ap05
#define VERSION_ap05 "0.1"
#endif /* VERSION_ap05 */
#ifndef MIN_VERSION_ap05
#define MIN_VERSION_ap05(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 1 || \
(major1) == 0 && (major2) == 1 && (minor) <= 0)
#endif /* MIN_VERSION_ap05 */
/* package HUnit-1.6.2.0 */
#ifndef VERSION_HUnit
#define VERSION_HUnit "1.6.2.0"
#endif /* VERSION_HUnit */
#ifndef MIN_VERSION_HUnit
#define MIN_VERSION_HUnit(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 6 || \
(major1) == 1 && (major2) == 6 && (minor) <= 2)
#endif /* MIN_VERSION_HUnit */
/* package base-4.17.2.0 */
#ifndef VERSION_base
#define VERSION_base "4.17.2.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 17 || \
(major1) == 4 && (major2) == 17 && (minor) <= 2)
#endif /* MIN_VERSION_base */
/* package mtl-2.2.2 */
#ifndef VERSION_mtl
#define VERSION_mtl "2.2.2"
#endif /* VERSION_mtl */
#ifndef MIN_VERSION_mtl
#define MIN_VERSION_mtl(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 2 || \
(major1) == 2 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_VERSION_mtl */
/* package text-2.0.2 */
#ifndef VERSION_text
#define VERSION_text "2.0.2"
#endif /* VERSION_text */
#ifndef MIN_VERSION_text
#define MIN_VERSION_text(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 0 || \
(major1) == 2 && (major2) == 0 && (minor) <= 2)
#endif /* MIN_VERSION_text */
/* tool alex-3.2.5 */
#ifndef TOOL_VERSION_alex
#define TOOL_VERSION_alex "3.2.5"
#endif /* TOOL_VERSION_alex */
#ifndef MIN_TOOL_VERSION_alex
#define MIN_TOOL_VERSION_alex(major1,major2,minor) (\
(major1) < 3 || \
(major1) == 3 && (major2) < 2 || \
(major1) == 3 && (major2) == 2 && (minor) <= 5)
#endif /* MIN_TOOL_VERSION_alex */
/* tool gcc-11 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "11"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 11 || \
(major1) == 11 && (major2) < 0 || \
(major1) == 11 && (major2) == 0 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-9.4.7 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "9.4.7"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-9.4.7 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "9.4.7"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.27.0 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.27.0"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 27 || \
(major1) == 2 && (major2) == 27 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool happy-1.19.12 */
#ifndef TOOL_VERSION_happy
#define TOOL_VERSION_happy "1.19.12"
#endif /* TOOL_VERSION_happy */
#ifndef MIN_TOOL_VERSION_happy
#define MIN_TOOL_VERSION_happy(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 19 || \
(major1) == 1 && (major2) == 19 && (minor) <= 12)
#endif /* MIN_TOOL_VERSION_happy */
/* tool hpc-0.68 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.68"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.8 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.8"
#endif /* TOOL_VERSION_hsc2hs */
#ifndef MIN_TOOL_VERSION_hsc2hs
#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool hscolour-1.24 */
#ifndef TOOL_VERSION_hscolour
#define TOOL_VERSION_hscolour "1.24"
#endif /* TOOL_VERSION_hscolour */
#ifndef MIN_TOOL_VERSION_hscolour
#define MIN_TOOL_VERSION_hscolour(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 24 || \
(major1) == 1 && (major2) == 24 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hscolour */
/* tool runghc-9.4.7 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "9.4.7"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.38 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.38"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 38 || \
(major1) == 2 && (major2) == 38 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "ap05-0.1-AJuyaSgzdSw4SJrI0SnuWg-ex03"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.1"
#endif /* CURRENT_PACKAGE_VERSION */
#undef CURRENT_PACKAGE_KEY
#undef CURRENT_COMPONENT_ID

View File

@@ -0,0 +1,173 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package ap05-0.1 */
#ifndef VERSION_ap05
#define VERSION_ap05 "0.1"
#endif /* VERSION_ap05 */
#ifndef MIN_VERSION_ap05
#define MIN_VERSION_ap05(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 1 || \
(major1) == 0 && (major2) == 1 && (minor) <= 0)
#endif /* MIN_VERSION_ap05 */
/* package HUnit-1.6.2.0 */
#ifndef VERSION_HUnit
#define VERSION_HUnit "1.6.2.0"
#endif /* VERSION_HUnit */
#ifndef MIN_VERSION_HUnit
#define MIN_VERSION_HUnit(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 6 || \
(major1) == 1 && (major2) == 6 && (minor) <= 2)
#endif /* MIN_VERSION_HUnit */
/* package base-4.17.2.0 */
#ifndef VERSION_base
#define VERSION_base "4.17.2.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 17 || \
(major1) == 4 && (major2) == 17 && (minor) <= 2)
#endif /* MIN_VERSION_base */
/* package mtl-2.2.2 */
#ifndef VERSION_mtl
#define VERSION_mtl "2.2.2"
#endif /* VERSION_mtl */
#ifndef MIN_VERSION_mtl
#define MIN_VERSION_mtl(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 2 || \
(major1) == 2 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_VERSION_mtl */
/* package text-2.0.2 */
#ifndef VERSION_text
#define VERSION_text "2.0.2"
#endif /* VERSION_text */
#ifndef MIN_VERSION_text
#define MIN_VERSION_text(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 0 || \
(major1) == 2 && (major2) == 0 && (minor) <= 2)
#endif /* MIN_VERSION_text */
/* tool alex-3.2.5 */
#ifndef TOOL_VERSION_alex
#define TOOL_VERSION_alex "3.2.5"
#endif /* TOOL_VERSION_alex */
#ifndef MIN_TOOL_VERSION_alex
#define MIN_TOOL_VERSION_alex(major1,major2,minor) (\
(major1) < 3 || \
(major1) == 3 && (major2) < 2 || \
(major1) == 3 && (major2) == 2 && (minor) <= 5)
#endif /* MIN_TOOL_VERSION_alex */
/* tool gcc-11 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "11"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 11 || \
(major1) == 11 && (major2) < 0 || \
(major1) == 11 && (major2) == 0 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-9.4.7 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "9.4.7"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-9.4.7 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "9.4.7"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.27.0 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.27.0"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 27 || \
(major1) == 2 && (major2) == 27 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool happy-1.19.12 */
#ifndef TOOL_VERSION_happy
#define TOOL_VERSION_happy "1.19.12"
#endif /* TOOL_VERSION_happy */
#ifndef MIN_TOOL_VERSION_happy
#define MIN_TOOL_VERSION_happy(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 19 || \
(major1) == 1 && (major2) == 19 && (minor) <= 12)
#endif /* MIN_TOOL_VERSION_happy */
/* tool hpc-0.68 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.68"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.8 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.8"
#endif /* TOOL_VERSION_hsc2hs */
#ifndef MIN_TOOL_VERSION_hsc2hs
#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool hscolour-1.24 */
#ifndef TOOL_VERSION_hscolour
#define TOOL_VERSION_hscolour "1.24"
#endif /* TOOL_VERSION_hscolour */
#ifndef MIN_TOOL_VERSION_hscolour
#define MIN_TOOL_VERSION_hscolour(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 24 || \
(major1) == 1 && (major2) == 24 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hscolour */
/* tool runghc-9.4.7 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "9.4.7"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.38 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.38"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 38 || \
(major1) == 2 && (major2) == 38 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "ap05-0.1-1WN5bfNZMxCBk9rV3xcl3T-ex01"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.1"
#endif /* CURRENT_PACKAGE_VERSION */
#undef CURRENT_PACKAGE_KEY
#undef CURRENT_COMPONENT_ID

View File

@@ -0,0 +1,173 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package ap05-0.1 */
#ifndef VERSION_ap05
#define VERSION_ap05 "0.1"
#endif /* VERSION_ap05 */
#ifndef MIN_VERSION_ap05
#define MIN_VERSION_ap05(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 1 || \
(major1) == 0 && (major2) == 1 && (minor) <= 0)
#endif /* MIN_VERSION_ap05 */
/* package HUnit-1.6.2.0 */
#ifndef VERSION_HUnit
#define VERSION_HUnit "1.6.2.0"
#endif /* VERSION_HUnit */
#ifndef MIN_VERSION_HUnit
#define MIN_VERSION_HUnit(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 6 || \
(major1) == 1 && (major2) == 6 && (minor) <= 2)
#endif /* MIN_VERSION_HUnit */
/* package base-4.17.2.0 */
#ifndef VERSION_base
#define VERSION_base "4.17.2.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 17 || \
(major1) == 4 && (major2) == 17 && (minor) <= 2)
#endif /* MIN_VERSION_base */
/* package mtl-2.2.2 */
#ifndef VERSION_mtl
#define VERSION_mtl "2.2.2"
#endif /* VERSION_mtl */
#ifndef MIN_VERSION_mtl
#define MIN_VERSION_mtl(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 2 || \
(major1) == 2 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_VERSION_mtl */
/* package text-2.0.2 */
#ifndef VERSION_text
#define VERSION_text "2.0.2"
#endif /* VERSION_text */
#ifndef MIN_VERSION_text
#define MIN_VERSION_text(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 0 || \
(major1) == 2 && (major2) == 0 && (minor) <= 2)
#endif /* MIN_VERSION_text */
/* tool alex-3.2.5 */
#ifndef TOOL_VERSION_alex
#define TOOL_VERSION_alex "3.2.5"
#endif /* TOOL_VERSION_alex */
#ifndef MIN_TOOL_VERSION_alex
#define MIN_TOOL_VERSION_alex(major1,major2,minor) (\
(major1) < 3 || \
(major1) == 3 && (major2) < 2 || \
(major1) == 3 && (major2) == 2 && (minor) <= 5)
#endif /* MIN_TOOL_VERSION_alex */
/* tool gcc-11 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "11"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 11 || \
(major1) == 11 && (major2) < 0 || \
(major1) == 11 && (major2) == 0 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-9.4.7 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "9.4.7"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-9.4.7 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "9.4.7"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.27.0 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.27.0"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 27 || \
(major1) == 2 && (major2) == 27 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool happy-1.19.12 */
#ifndef TOOL_VERSION_happy
#define TOOL_VERSION_happy "1.19.12"
#endif /* TOOL_VERSION_happy */
#ifndef MIN_TOOL_VERSION_happy
#define MIN_TOOL_VERSION_happy(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 19 || \
(major1) == 1 && (major2) == 19 && (minor) <= 12)
#endif /* MIN_TOOL_VERSION_happy */
/* tool hpc-0.68 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.68"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.8 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.8"
#endif /* TOOL_VERSION_hsc2hs */
#ifndef MIN_TOOL_VERSION_hsc2hs
#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool hscolour-1.24 */
#ifndef TOOL_VERSION_hscolour
#define TOOL_VERSION_hscolour "1.24"
#endif /* TOOL_VERSION_hscolour */
#ifndef MIN_TOOL_VERSION_hscolour
#define MIN_TOOL_VERSION_hscolour(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 24 || \
(major1) == 1 && (major2) == 24 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hscolour */
/* tool runghc-9.4.7 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "9.4.7"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 4 || \
(major1) == 9 && (major2) == 4 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.38 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.38"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 38 || \
(major1) == 2 && (major2) == 38 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "ap05-0.1-95SecnZIX6WJ1hjkoNBMel-ex02"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.1"
#endif /* CURRENT_PACKAGE_VERSION */
#undef CURRENT_PACKAGE_KEY
#undef CURRENT_COMPONENT_ID

Binary file not shown.

3
Aufgabe_5/code/.vscode/settings.json vendored Executable file
View File

@@ -0,0 +1,3 @@
{
"haskell.plugin.hlint.codeActionsOn": false
}

Binary file not shown.

97
Aufgabe_5/code/ap05.cabal Normal file
View File

@@ -0,0 +1,97 @@
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack
name: ap05
version: 0.1
synopsis: ap05
license: BSD3
build-type: Simple
flag test-mode
description: By default, do not run instructor tests
manual: True
default: False
test-suite ex01
type: exitcode-stdio-1.0
main-is: Main.hs
other-modules:
Exp
Paths_ap05
hs-source-dirs:
ex01
default-extensions:
ScopedTypeVariables
ghc-options: -Werror -W -fwarn-unused-binds -fwarn-orphans -fwarn-unused-matches -fwarn-unused-do-bind -fwarn-wrong-do-bind -fwarn-missing-signatures -fno-warn-partial-type-signatures -Wredundant-constraints
build-depends:
HUnit
, base
, mtl
, text
default-language: Haskell2010
if flag(test-mode)
build-depends:
bytestring
, directory
, filepath
, haskell-src-meta
, main-tester
, template-haskell
else
test-suite ex02
type: exitcode-stdio-1.0
main-is: Main.hs
other-modules:
Product
Paths_ap05
hs-source-dirs:
ex02
default-extensions:
ScopedTypeVariables
ghc-options: -Werror -W -fwarn-unused-binds -fwarn-orphans -fwarn-unused-matches -fwarn-unused-do-bind -fwarn-wrong-do-bind -fwarn-missing-signatures -fno-warn-partial-type-signatures -Wredundant-constraints
build-depends:
HUnit
, base
, mtl
, text
default-language: Haskell2010
if flag(test-mode)
build-depends:
bytestring
, directory
, filepath
, haskell-src-meta
, main-tester
, template-haskell
else
test-suite ex03
type: exitcode-stdio-1.0
main-is: Main.hs
other-modules:
Random
Paths_ap05
hs-source-dirs:
ex03
default-extensions:
ScopedTypeVariables
ghc-options: -Werror -W -fwarn-unused-binds -fwarn-orphans -fwarn-unused-matches -fwarn-unused-do-bind -fwarn-wrong-do-bind -fwarn-missing-signatures -fno-warn-partial-type-signatures -Wredundant-constraints
build-depends:
HUnit
, base
, mtl
, text
default-language: Haskell2010
if flag(test-mode)
build-depends:
bytestring
, directory
, filepath
, haskell-src-meta
, main-tester
, template-haskell
else

128
Aufgabe_5/code/ex01/Exp.hs Executable file
View File

@@ -0,0 +1,128 @@
module Exp where
import Test.HUnit
import Data.Maybe (fromMaybe)
-- Tests
allTests :: Test
allTests = TestList [
TestLabel "testEval1" testEval1,
TestLabel "testEval2" testEval2,
TestLabel "testEval3" testEval3
]
data Exp = ExpAdd Exp Exp
| ExpMult Exp Exp
| ExpDiv Exp Exp
| Const Integer
---------------------------------------------
-- eval1
---------------------------------------------
eval1 :: Exp -> Maybe Integer
eval1 exp =
case exp of
ExpAdd exp1 exp2 ->
let outcomeExp1 = eval1 exp1
outcomeExp2 = eval1 exp2
in
case outcomeExp1 of
Nothing -> Nothing
_ -> case outcomeExp2 of
Nothing -> Nothing
_ -> Just (fromMaybe 0 outcomeExp1 + fromMaybe 0 outcomeExp2)
ExpMult exp1 exp2 ->
let outcomeExp1 = eval1 exp1
outcomeExp2 = eval1 exp2
in
case outcomeExp1 of
Nothing -> Nothing
_ -> case outcomeExp2 of
Nothing -> Nothing
_ -> Just (fromMaybe 0 outcomeExp1 * fromMaybe 0 outcomeExp2)
ExpDiv exp1 exp2 ->
let outcomeExp1 = eval1 exp1
outcomeExp2 = eval1 exp2
in
case outcomeExp1 of
Nothing -> Nothing
_ -> case outcomeExp2 of
Nothing -> Nothing
Just 0 -> Nothing
_ -> Just (fromMaybe 0 outcomeExp1 `div` fromMaybe 0 outcomeExp2)
Const value -> Just value
---------------------------------------------
-- Test eval1
---------------------------------------------
testEval1 :: Test
testEval1 = TestCase $ do
assertEqual "test1" (Just 4) (eval1 (Const 4))
assertEqual "test2" (Nothing) (eval1 (ExpDiv (ExpAdd (Const 4) (Const 5)) (Const 0)))
assertEqual "test3" (Just 2) (eval1 (ExpDiv (ExpAdd (Const 4) (Const 10)) (Const 7)))
---------------------------------------------
-- eval2
---------------------------------------------
eval2 :: Exp -> Maybe Integer
eval2 exp =
case exp of
ExpAdd exp1 exp2 -> do
outcomeExp1 <- eval2 exp1
outcomeExp2 <- eval2 exp2
pure (outcomeExp1 + outcomeExp2)
ExpMult exp1 exp2 -> do
outcomeExp1 <- eval2 exp1
outcomeExp2 <- eval2 exp2
pure (outcomeExp1 * outcomeExp2)
ExpDiv exp1 exp2 -> do
outcomeExp1 <- eval2 exp1
outcomeExp2 <- eval2 exp2
if outcomeExp2 == 0
then Nothing
else pure (outcomeExp1 `div` outcomeExp2)
Const x ->
pure x
---------------------------------------------
-- Test eval2
---------------------------------------------
testEval2 :: Test
testEval2 = TestCase $ do
assertEqual "test1" (Just 4) (eval2 (Const 4))
assertEqual "test2" (Nothing) (eval2 (ExpDiv (ExpAdd (Const 4) (Const 5)) (Const 0)))
assertEqual "test3" (Just 2) (eval2 (ExpDiv (ExpAdd (Const 4) (Const 10)) (Const 7)))
---------------------------------------------
-- eval3
---------------------------------------------
eval3 :: Exp -> Maybe Integer
eval3 exp =
case exp of
ExpAdd exp1 exp2 ->
eval3 exp1 >>= \x1 ->
eval3 exp2 >>= \x2 ->
pure (x1 + x2)
ExpMult exp1 exp2 ->
eval3 exp1 >>= \x1 ->
eval3 exp2 >>= \x2 ->
pure (x1 * x2)
ExpDiv exp1 exp2 ->
eval3 exp1 >>= \x1 ->
eval3 exp2 >>= \x2 ->
if x2 == 0
then Nothing
else pure (x1 `div` x2)
Const x ->
pure x
---------------------------------------------
-- Test eval3
---------------------------------------------
testEval3 :: Test
testEval3 = TestCase $ do
assertEqual "test1" (Just 4) (eval3 (Const 4))
assertEqual "test2" Nothing (eval3 (ExpDiv (ExpAdd (Const 4) (Const 5)) (Const 0)))
assertEqual "test3" (Just 2) (eval3 (ExpDiv (ExpAdd (Const 4) (Const 10)) (Const 7)))

7
Aufgabe_5/code/ex01/Main.hs Executable file
View File

@@ -0,0 +1,7 @@
module Main where
import Exp (allTests)
import Test.HUnit (runTestTTAndExit)
main :: IO ()
main = runTestTTAndExit allTests

7
Aufgabe_5/code/ex02/Main.hs Executable file
View File

@@ -0,0 +1,7 @@
module Main where
import Product (allTests)
import Test.HUnit (runTestTTAndExit)
main :: IO ()
main = runTestTTAndExit allTests

71
Aufgabe_5/code/ex02/Product.hs Executable file
View File

@@ -0,0 +1,71 @@
module Product where
import Control.Monad.Reader
import Test.HUnit
import Data.List (intercalate)
-- Beispielwerte
-- 1 Euro kostet 1,14 Dollar
-- 1 Euro kostet 1,05 CHF
data Config = Config { dollarRate :: Double, chfRate :: Double }
data Price
= PriceEuro Double
| PriceDollar Double
| PriceCHF Double
data Product
= Product
{ productName :: String
, productQuantity :: Int
, productSinglePrice :: Price
}
data Invoice
= Invoice
{ invoiceCustomer :: String
, invoiceProducts :: [Product]
}
sampleInvoice :: Invoice
sampleInvoice =
Invoice
{ invoiceCustomer = "Stefan Wehr"
, invoiceProducts = [p1, p2]
}
where
p1 = Product "Feinstimmer Geige" 2 (PriceDollar 9.1086)
p2 = Product "HX Effects" 1 (PriceCHF 523.95)
formatInvoice :: Invoice -> Reader Config String
formatInvoice invoice = do
productStrings <- traverse formatProduct (invoiceProducts invoice)
let customer = invoiceCustomer invoice ++ "\n\n"
let products = intercalate "\n" productStrings
return $ customer ++ products
formatProduct :: Product -> Reader Config String
formatProduct product = do
price <- convertPrice $ productSinglePrice product
return $ productName product ++ " (" ++ show (productQuantity product) ++ "x) " ++ show price ++ " EUR"
convertPrice :: Price -> Reader Config Double
convertPrice price = do
priceRates <- ask
case price of
PriceEuro euro -> return euro
PriceDollar dollar -> return $ if dollarRate priceRates <= 0 then error "Dollar rate is 0 or negative" else dollar / dollarRate priceRates
PriceCHF chf -> return $ if chfRate priceRates <= 0 then error "CHF rate is 0 or negative." else chf / chfRate priceRates
-- Tests
allTests :: Test
allTests = TestList [
TestLabel "testFormatInvoice" testFormatInvoice
]
testFormatInvoice :: Test
testFormatInvoice = TestCase $ do
let config = Config 1.14 1.05
let formattedInvoice = runReader (formatInvoice sampleInvoice) config
assertEqual "test1" "Stefan Wehr\n\nFeinstimmer Geige (2x) 7.99 EUR\nHX Effects (1x) 499.0 EUR" formattedInvoice

7
Aufgabe_5/code/ex03/Main.hs Executable file
View File

@@ -0,0 +1,7 @@
module Main where
import Random (allTests)
import Test.HUnit (runTestTTAndExit)
main :: IO ()
main = runTestTTAndExit allTests

37
Aufgabe_5/code/ex03/Random.hs Executable file
View File

@@ -0,0 +1,37 @@
module Random where
import Control.Monad.State.Lazy
import Test.HUnit hiding (State)
type Random a = State Integer a
-- X <- (aX + c) mod m
fresh :: Random Integer
fresh = do
lastRand <- get
let newRand = (6364136223846793005 * lastRand + 1442695040888963407) `mod` 2 ^ 64
put newRand
return newRand
runPRNG :: Random a -> Integer -> a
runPRNG action init = fst $ runState action init
threeRandomNumbers :: Random [Integer]
threeRandomNumbers = do
rand1 <- fresh
rand2 <- fresh
rand3 <- fresh
return [rand1, rand2, rand3]
testThreeRandomNumbers :: Test
testThreeRandomNumbers = TestCase $
let seed = 1
randomNumbers = runPRNG threeRandomNumbers seed
in do
assertEqual "test1" [7806831264735756412, 9396908728118811419, 11960119808228829710] randomNumbers
-- Tests
allTests :: Test
allTests = TestList [
TestLabel "testThreeRandomNumbers" testThreeRandomNumbers
]

51
Aufgabe_5/code/package.yaml Executable file
View File

@@ -0,0 +1,51 @@
name: ap05
version: 0.1
synopsis: ap05
license: BSD3
dependencies:
- base
- HUnit
- mtl
- text
tests:
ex01:
main: Main.hs
source-dirs: ex01
ex02:
main: Main.hs
source-dirs: ex02
ex03:
main: Main.hs
source-dirs: ex03
ghc-options:
- -Werror -W -fwarn-unused-binds -fwarn-orphans
- -fwarn-unused-matches -fwarn-unused-do-bind -fwarn-wrong-do-bind
- -fwarn-missing-signatures -fno-warn-partial-type-signatures
- -Wredundant-constraints
default-extensions:
- ScopedTypeVariables
# Setup for running tests in praktomat
flags:
test-mode:
description: "By default, do not run instructor tests"
manual: true
default: false
when:
- condition: flag(test-mode)
then:
dependencies:
- template-haskell
- haskell-src-meta
- filepath
- bytestring
- directory
- main-tester
else:
dependencies: []

3
Aufgabe_5/code/stack.yaml Executable file
View File

@@ -0,0 +1,3 @@
resolver: lts-21.14
packages:
- .

View File

@@ -0,0 +1,12 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
packages: []
snapshots:
- completed:
sha256: 60e54c1ba3c1e7163acf6dafa9d56b2d3b23f88a31ad53a1c9d888f32561f8da
size: 639819
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/14.yaml
original: lts-21.14