✨ try-catch

This commit is contained in:
NikolajDanger committed 2024-10-04 13:29:34 +02:00
1 parent fb7f5c936a
commit 46aa789d64
66 files changed
+564

No files matched your search

View File
Whitespace-only changes.
@@ -0,0 +1,25 @@
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -w #-}
module PackageInfo_a4 (
name,
version,
synopsis,
copyright,
homepage,
) where
import Data.Version (Version(..))
import Prelude
name :: String
name = "a4"
version :: Version
version = Version [1,0,0,0] []
synopsis :: String
synopsis = ""
copyright :: String
copyright = ""
homepage :: String
homepage = ""
@@ -0,0 +1,77 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoRebindableSyntax #-}
#if __GLASGOW_HASKELL__ >= 810
{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}
#endif
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -w #-}
module Paths_a4 (
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 [1,0,0,0] []
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/nikolaj/.cabal/bin"
libdir = "/home/nikolaj/.cabal/lib/x86_64-linux-ghc-9.2.8/a4-1.0.0.0-inplace"
dynlibdir = "/home/nikolaj/.cabal/lib/x86_64-linux-ghc-9.2.8"
datadir = "/home/nikolaj/.cabal/share/x86_64-linux-ghc-9.2.8/a4-1.0.0.0"
libexecdir = "/home/nikolaj/.cabal/libexec/x86_64-linux-ghc-9.2.8/a4-1.0.0.0"
sysconfdir = "/home/nikolaj/.cabal/etc"
getBinDir = catchIO (getEnv "a4_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "a4_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "a4_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "a4_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "a4_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "a4_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 == '/'
@@ -0,0 +1,163 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package a4-1.0.0.0 */
#ifndef VERSION_a4
#define VERSION_a4 "1.0.0.0"
#endif /* VERSION_a4 */
#ifndef MIN_VERSION_a4
#define MIN_VERSION_a4(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 0 || \
(major1) == 1 && (major2) == 0 && (minor) <= 0)
#endif /* MIN_VERSION_a4 */
/* package base-4.16.4.0 */
#ifndef VERSION_base
#define VERSION_base "4.16.4.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 16 || \
(major1) == 4 && (major2) == 16 && (minor) <= 4)
#endif /* MIN_VERSION_base */
/* package directory-1.3.6.2 */
#ifndef VERSION_directory
#define VERSION_directory "1.3.6.2"
#endif /* VERSION_directory */
#ifndef MIN_VERSION_directory
#define MIN_VERSION_directory(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 3 || \
(major1) == 1 && (major2) == 3 && (minor) <= 6)
#endif /* MIN_VERSION_directory */
/* package process-1.6.16.0 */
#ifndef VERSION_process
#define VERSION_process "1.6.16.0"
#endif /* VERSION_process */
#ifndef MIN_VERSION_process
#define MIN_VERSION_process(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 6 || \
(major1) == 1 && (major2) == 6 && (minor) <= 16)
#endif /* MIN_VERSION_process */
/* package tasty-1.5 */
#ifndef VERSION_tasty
#define VERSION_tasty "1.5"
#endif /* VERSION_tasty */
#ifndef MIN_VERSION_tasty
#define MIN_VERSION_tasty(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 5 || \
(major1) == 1 && (major2) == 5 && (minor) <= 0)
#endif /* MIN_VERSION_tasty */
/* package tasty-hunit-0.10.2 */
#ifndef VERSION_tasty_hunit
#define VERSION_tasty_hunit "0.10.2"
#endif /* VERSION_tasty_hunit */
#ifndef MIN_VERSION_tasty_hunit
#define MIN_VERSION_tasty_hunit(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 10 || \
(major1) == 0 && (major2) == 10 && (minor) <= 2)
#endif /* MIN_VERSION_tasty_hunit */
/* tool gcc-14.2.1 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "14.2.1"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 14 || \
(major1) == 14 && (major2) < 2 || \
(major1) == 14 && (major2) == 2 && (minor) <= 1)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-9.2.8 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "9.2.8"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 2 || \
(major1) == 9 && (major2) == 2 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-9.2.8 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "9.2.8"
#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) < 2 || \
(major1) == 9 && (major2) == 2 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.26.0 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.26.0"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 26 || \
(major1) == 2 && (major2) == 26 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_haddock */
/* 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 pkg-config-2.1.1 */
#ifndef TOOL_VERSION_pkg_config
#define TOOL_VERSION_pkg_config "2.1.1"
#endif /* TOOL_VERSION_pkg_config */
#ifndef MIN_TOOL_VERSION_pkg_config
#define MIN_TOOL_VERSION_pkg_config(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 1 || \
(major1) == 2 && (major2) == 1 && (minor) <= 1)
#endif /* MIN_TOOL_VERSION_pkg_config */
/* tool runghc-9.2.8 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "9.2.8"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 2 || \
(major1) == 9 && (major2) == 2 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.43 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.43"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 43 || \
(major1) == 2 && (major2) == 43 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_PACKAGE_KEY
#define CURRENT_PACKAGE_KEY "a4-1.0.0.0-inplace"
#endif /* CURRENT_packageKey */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "a4-1.0.0.0-inplace"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "1.0.0.0"
#endif /* CURRENT_PACKAGE_VERSION */
@@ -0,0 +1,25 @@
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -w #-}
module PackageInfo_a4 (
name,
version,
synopsis,
copyright,
homepage,
) where
import Data.Version (Version(..))
import Prelude
name :: String
name = "a4"
version :: Version
version = Version [1,0,0,0] []
synopsis :: String
synopsis = ""
copyright :: String
copyright = ""
homepage :: String
homepage = ""
@@ -0,0 +1,77 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoRebindableSyntax #-}
#if __GLASGOW_HASKELL__ >= 810
{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}
#endif
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -w #-}
module Paths_a4 (
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 [1,0,0,0] []
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/nikolaj/.cabal/bin"
libdir = "/home/nikolaj/.cabal/lib/x86_64-linux-ghc-9.2.8/a4-1.0.0.0-inplace-a4-test"
dynlibdir = "/home/nikolaj/.cabal/lib/x86_64-linux-ghc-9.2.8"
datadir = "/home/nikolaj/.cabal/share/x86_64-linux-ghc-9.2.8/a4-1.0.0.0"
libexecdir = "/home/nikolaj/.cabal/libexec/x86_64-linux-ghc-9.2.8/a4-1.0.0.0"
sysconfdir = "/home/nikolaj/.cabal/etc"
getBinDir = catchIO (getEnv "a4_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "a4_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "a4_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "a4_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "a4_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "a4_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 == '/'
@@ -0,0 +1,140 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package a4-1.0.0.0 */
#ifndef VERSION_a4
#define VERSION_a4 "1.0.0.0"
#endif /* VERSION_a4 */
#ifndef MIN_VERSION_a4
#define MIN_VERSION_a4(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 0 || \
(major1) == 1 && (major2) == 0 && (minor) <= 0)
#endif /* MIN_VERSION_a4 */
/* package a4-1.0.0.0 */
#ifndef VERSION_a4
#define VERSION_a4 "1.0.0.0"
#endif /* VERSION_a4 */
#ifndef MIN_VERSION_a4
#define MIN_VERSION_a4(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 0 || \
(major1) == 1 && (major2) == 0 && (minor) <= 0)
#endif /* MIN_VERSION_a4 */
/* package base-4.16.4.0 */
#ifndef VERSION_base
#define VERSION_base "4.16.4.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 16 || \
(major1) == 4 && (major2) == 16 && (minor) <= 4)
#endif /* MIN_VERSION_base */
/* package tasty-1.5 */
#ifndef VERSION_tasty
#define VERSION_tasty "1.5"
#endif /* VERSION_tasty */
#ifndef MIN_VERSION_tasty
#define MIN_VERSION_tasty(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 5 || \
(major1) == 1 && (major2) == 5 && (minor) <= 0)
#endif /* MIN_VERSION_tasty */
/* tool gcc-14.2.1 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "14.2.1"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 14 || \
(major1) == 14 && (major2) < 2 || \
(major1) == 14 && (major2) == 2 && (minor) <= 1)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-9.2.8 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "9.2.8"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 2 || \
(major1) == 9 && (major2) == 2 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-9.2.8 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "9.2.8"
#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) < 2 || \
(major1) == 9 && (major2) == 2 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.26.0 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.26.0"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 26 || \
(major1) == 2 && (major2) == 26 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_haddock */
/* 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 pkg-config-2.1.1 */
#ifndef TOOL_VERSION_pkg_config
#define TOOL_VERSION_pkg_config "2.1.1"
#endif /* TOOL_VERSION_pkg_config */
#ifndef MIN_TOOL_VERSION_pkg_config
#define MIN_TOOL_VERSION_pkg_config(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 1 || \
(major1) == 2 && (major2) == 1 && (minor) <= 1)
#endif /* MIN_TOOL_VERSION_pkg_config */
/* tool runghc-9.2.8 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "9.2.8"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 2 || \
(major1) == 9 && (major2) == 2 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.43 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.43"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 43 || \
(major1) == 2 && (major2) == 43 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "a4-1.0.0.0-inplace-a4-test"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "1.0.0.0"
#endif /* CURRENT_PACKAGE_VERSION */
@@ -0,0 +1,3 @@
Test suite a4-test: RUNNING...
Test suite a4-test: PASS
Test suite logged to: /home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0/t/a4-test/test/a4-1.0.0.0-a4-test.log
@@ -0,0 +1 @@
PackageLog {package = PackageIdentifier {pkgName = PackageName "a4", pkgVersion = mkVersion [1,0,0,0]}, compiler = CompilerId GHC (mkVersion [9,2,8]), platform = Platform X86_64 Linux, testSuites = [TestSuiteLog {testSuiteName = UnqualComponentName "a4-test", testLogs = TestLog {testName = "a4-test", testOptionsReturned = [], testResult = Pass}, logFile = "/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0/t/a4-test/test/a4-1.0.0.0-a4-test.log"}]}
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
{"cabal-version":"3.12.1.0","cabal-lib-version":"3.12.1.0","compiler-id":"ghc-9.2.8","os":"linux","arch":"x86_64","install-plan":[{"type":"configured","id":"a4-1.0.0.0-inplace","pkg-name":"a4","pkg-version":"1.0.0.0","flags":{},"style":"local","pkg-src":{"type":"local","path":"/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/."},"dist-dir":"/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0","build-info":"/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0/build-info.json","depends":["base-4.16.4.0","directory-1.3.6.2","process-1.6.16.0","tasty-1.5-9c8bfa897c4bbbd45db59166bf8822fd731902e914b534b6a833c6ed622f52af","tasty-hunit-0.10.2-e3418cb0d0858b924fc6872fee2cea6b263d1c0a41eb00025dc20a99cba863f6"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"a4-1.0.0.0-inplace-a4-test","pkg-name":"a4","pkg-version":"1.0.0.0","flags":{},"style":"local","pkg-src":{"type":"local","path":"/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/."},"dist-dir":"/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0/t/a4-test","build-info":"/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0/t/a4-test/build-info.json","depends":["a4-1.0.0.0-inplace","base-4.16.4.0","tasty-1.5-9c8bfa897c4bbbd45db59166bf8822fd731902e914b534b6a833c6ed622f52af"],"exe-depends":[],"component-name":"test:a4-test","bin-file":"/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0/t/a4-test/build/a4-test/a4-test"},{"type":"configured","id":"ansi-terminal-1.1.1-a310ba3f6873f33f2e0b62f019c3a0e094e4880d99ffe33dea8cc3540173c20d","pkg-name":"ansi-terminal","pkg-version":"1.1.1","flags":{"example":false},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"5b3e9228323416a1962d5948b18f9eff8569ad94a368e15f0e6104128783f572","pkg-src-sha256":"7e448fcdf8a5a97f3d30e5168f834641df9945fafa65f2e87d73ff9556a1bc4c","depends":["ansi-terminal-types-1.1-de0d9944f2a71db2aa9c642f6d4eecaaf6274e2bb3d1ca13d6e5acb22267b82a","base-4.16.4.0","colour-2.3.6-da21b0778b8ee400b7b41504a069012d6a571b1bbdf970c88af02431ec232de5"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"ansi-terminal-types-1.1-de0d9944f2a71db2aa9c642f6d4eecaaf6274e2bb3d1ca13d6e5acb22267b82a","pkg-name":"ansi-terminal-types","pkg-version":"1.1","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"135f6a381afa19d53d0a3fe40b6dd47e6666c538b09e4300fbb1438759df3248","pkg-src-sha256":"f2e5333eb78da5f4dd330fca0c81a59276cc150c625647cd20f57b7f297a5d25","depends":["base-4.16.4.0","colour-2.3.6-da21b0778b8ee400b7b41504a069012d6a571b1bbdf970c88af02431ec232de5"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"array-0.5.4.0","pkg-name":"array","pkg-version":"0.5.4.0","depends":["base-4.16.4.0"]},{"type":"pre-existing","id":"base-4.16.4.0","pkg-name":"base","pkg-version":"4.16.4.0","depends":["ghc-bignum-1.2","ghc-prim-0.8.0","rts-1.0.2"]},{"type":"pre-existing","id":"binary-0.8.9.0","pkg-name":"binary","pkg-version":"0.8.9.0","depends":["array-0.5.4.0","base-4.16.4.0","bytestring-0.11.4.0","containers-0.6.5.1"]},{"type":"pre-existing","id":"bytestring-0.11.4.0","pkg-name":"bytestring","pkg-version":"0.11.4.0","depends":["base-4.16.4.0","deepseq-1.4.6.1","ghc-prim-0.8.0","template-haskell-2.18.0.0"]},{"type":"configured","id":"call-stack-0.4.0-9e69d84a2e7b76054d5195955c926fd4f70262e3a677c36bbcd9402102b8289c","pkg-name":"call-stack","pkg-version":"0.4.0","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"ac44d2c00931dc20b01750da8c92ec443eb63a7231e8550188cb2ac2385f7feb","pkg-src-sha256":"430bcf8a3404f7e55319573c0b807b1356946f0c8f289bb3d9afb279c636b87b","depends":["base-4.16.4.0"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"colour-2.3.6-da21b0778b8ee400b7b41504a069012d6a571b1bbdf970c88af02431ec232de5","pkg-name":"colour","pkg-version":"2.3.6","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"ebdcbf15023958838a527e381ab3c3b1e99ed12d1b25efeb7feaa4ad8c37664a","pkg-src-sha256":"2cd35dcd6944a5abc9f108a5eb5ee564b6b1fa98a9ec79cefcc20b588991f871","depends":["base-4.16.4.0"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"containers-0.6.5.1","pkg-name":"containers","pkg-version":"0.6.5.1","depends":["array-0.5.4.0","base-4.16.4.0","deepseq-1.4.6.1"]},{"type":"pre-existing","id":"deepseq-1.4.6.1","pkg-name":"deepseq","pkg-version":"1.4.6.1","depends":["array-0.5.4.0","base-4.16.4.0"]},{"type":"pre-existing","id":"directory-1.3.6.2","pkg-name":"directory","pkg-veLine truncated
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,32 @@
name: a4
version: 1.0.0.0
visibility: public
id: a4-1.0.0.0-inplace
key: a4-1.0.0.0-inplace
abi: inplace
exposed: True
exposed-modules:
APL.AST APL.Eval APL.InterpIO APL.InterpPure APL.Interp_Tests
APL.Monad APL.Util
import-dirs:
/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0/build
library-dirs:
/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0/build
dynamic-library-dirs:
/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0/build
data-dir: /home/nikolaj/Code/KU/2024B1-AP/assignments/a4/.
hs-libraries: HSa4-1.0.0.0-inplace
depends:
base-4.16.4.0 directory-1.3.6.2 process-1.6.16.0
tasty-1.5-9c8bfa897c4bbbd45db59166bf8822fd731902e914b534b6a833c6ed622f52af
tasty-hunit-0.10.2-e3418cb0d0858b924fc6872fee2cea6b263d1c0a41eb00025dc20a99cba863f6
haddock-interfaces:
/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0/doc/html/a4/a4.haddock
haddock-html:
/home/nikolaj/Code/KU/2024B1-AP/assignments/a4/dist-newstyle/build/x86_64-linux/ghc-9.2.8/a4-1.0.0.0/doc/html/a4
Binary file not shown.
Whitespace-only changes.
+4
View File
@@ -13,4 +13,8 @@ runEval = runEval' envEmpty stateInitial
runEval' r s (Free (PrintOp p m)) =
let (ps, res) = runEval' r s m
in (p : ps, res)
runEval' r s (Free (TryCatchOp m l)) =
case (runEval' r s m) of
(_, Left e) -> runEval' r s l
a -> a
runEval' _ _ (Free (ErrorOp e)) = ([], Left e)
+16
View File
@@ -65,6 +65,22 @@ pureTests =
--
testCase "Div0" $
eval' (Div (CstInt 7) (CstInt 0))
@?= ([], Left "Division by zero"),
--
testCase "TryCatch try1" $
eval' (TryCatch (CstInt 1) (CstInt 2))
@?= ([], Right (ValInt 1)),
--
testCase "TryCatch try2" $
eval' (TryCatch (CstInt 1) (Div (CstInt 1) (CstInt 0)))
@?= ([], Right (ValInt 1)),
--
testCase "TryCatch catch1" $
eval' (TryCatch (Div (CstInt 1) (CstInt 0)) (CstInt 1))
@?= ([], Right (ValInt 1)),
--
testCase "TryCatch catch1" $
eval' (TryCatch (Div (CstInt 1) (CstInt 0)) (Div (CstInt 1) (CstInt 0)))
@?= ([], Left "Division by zero")
]