-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Playing with arbitrary data and testing instances
- Loading branch information
Anastasios Valtinos
committed
Oct 14, 2022
1 parent
64289ae
commit 934df9e
Showing
28 changed files
with
322 additions
and
25 deletions.
There are no files selected for viewing
22 changes: 0 additions & 22 deletions
22
...ell Excercises & Code/Chapter25 - Composing Types/92b7cb37-2583-4e69-b659-1a761af1d688.hs
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
Haskell Excercises & Code/Chapter25 - Composing Types/EitherTT.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module EitherTT where | ||
|
||
import Test.QuickCheck | ||
-- newtype MaybeT m a = | ||
-- MaybeT { runMaybeT :: m (Maybe a) } | ||
|
||
|
||
newtype EitherT e m a = EitherT { runEitherT :: m (Either e a) } | ||
|
||
newtype TestData a b = TestData b deriving (Eq, Show) | ||
|
||
-- Github Arbitrary example | ||
-- instance Arbitrary Cell where | ||
-- arbitrary = do | ||
-- Positive x <- arbitrary | ||
-- Positive y <- arbitrary | ||
-- return $ Cell x y | ||
|
||
-- arbitrary :: Gen a | ||
genArbit :: (Arbitrary a, Arbitrary b) => Gen (TestData a b) | ||
genArbit = do | ||
x1 <- arbitrary | ||
return $ TestData x1 | ||
|
||
randomGen = sample' (genArbit :: Gen (TestData Int Int)) | ||
|
||
-- 1. Write the Functor instance for EitherT: | ||
instance Functor m => Functor (EitherT e m) where | ||
fmap f (EitherT ema) = EitherT $ (fmap . fmap) f ema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Haskell Excercises & Code/Chapter25 - Composing Types/compose.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: composing | ||
version: 0.1.0.0 | ||
license-file: LICENSE | ||
author: Chicken Little | ||
maintainer: sky@isfalling.org | ||
category: Text | ||
build-type: Simple | ||
cabal-version: >=1.10 | ||
|
||
library | ||
exposed-modules: EitherTT | ||
ghc-options: -Wall -fwarn-tabs | ||
build-depends: base >=4.7 && <5 | ||
, hspec | ||
, QuickCheck | ||
hs-source-dirs: . | ||
default-language: Haskell2010 |
Binary file added
BIN
+10.4 KB
...ng Types/dist-newstyle/build/x86_64-windows/ghc-9.2.1/composing-0.1.0.0/build/EitherTT.hi
Binary file not shown.
Binary file added
BIN
+13.7 KB
...ing Types/dist-newstyle/build/x86_64-windows/ghc-9.2.1/composing-0.1.0.0/build/EitherTT.o
Binary file not shown.
74 changes: 74 additions & 0 deletions
74
...ewstyle/build/x86_64-windows/ghc-9.2.1/composing-0.1.0.0/build/autogen/Paths_composing.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{-# LANGUAGE CPP #-} | ||
{-# LANGUAGE NoRebindableSyntax #-} | ||
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-} | ||
{-# OPTIONS_GHC -w #-} | ||
module Paths_composing ( | ||
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,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 = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\bin" | ||
libdir = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\x86_64-windows-ghc-9.2.1\\composing-0.1.0.0-inplace" | ||
dynlibdir = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\x86_64-windows-ghc-9.2.1" | ||
datadir = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\x86_64-windows-ghc-9.2.1\\composing-0.1.0.0" | ||
libexecdir = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\composing-0.1.0.0-inplace\\x86_64-windows-ghc-9.2.1\\composing-0.1.0.0" | ||
sysconfdir = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\etc" | ||
|
||
getBinDir = catchIO (getEnv "composing_bindir") (\_ -> return bindir) | ||
getLibDir = catchIO (getEnv "composing_libdir") (\_ -> return libdir) | ||
getDynLibDir = catchIO (getEnv "composing_dynlibdir") (\_ -> return dynlibdir) | ||
getDataDir = catchIO (getEnv "composing_datadir") (\_ -> return datadir) | ||
getLibexecDir = catchIO (getEnv "composing_libexecdir") (\_ -> return libexecdir) | ||
getSysconfDir = catchIO (getEnv "composing_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 == '/' || c == '\\' |
133 changes: 133 additions & 0 deletions
133
...st-newstyle/build/x86_64-windows/ghc-9.2.1/composing-0.1.0.0/build/autogen/cabal_macros.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* DO NOT EDIT: This file is automatically generated by Cabal */ | ||
|
||
/* package composing-0.1.0.0 */ | ||
#ifndef VERSION_composing | ||
#define VERSION_composing "0.1.0.0" | ||
#endif /* VERSION_composing */ | ||
#ifndef MIN_VERSION_composing | ||
#define MIN_VERSION_composing(major1,major2,minor) (\ | ||
(major1) < 0 || \ | ||
(major1) == 0 && (major2) < 1 || \ | ||
(major1) == 0 && (major2) == 1 && (minor) <= 0) | ||
#endif /* MIN_VERSION_composing */ | ||
/* package QuickCheck-2.14.2 */ | ||
#ifndef VERSION_QuickCheck | ||
#define VERSION_QuickCheck "2.14.2" | ||
#endif /* VERSION_QuickCheck */ | ||
#ifndef MIN_VERSION_QuickCheck | ||
#define MIN_VERSION_QuickCheck(major1,major2,minor) (\ | ||
(major1) < 2 || \ | ||
(major1) == 2 && (major2) < 14 || \ | ||
(major1) == 2 && (major2) == 14 && (minor) <= 2) | ||
#endif /* MIN_VERSION_QuickCheck */ | ||
/* package base-4.16.0.0 */ | ||
#ifndef VERSION_base | ||
#define VERSION_base "4.16.0.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) <= 0) | ||
#endif /* MIN_VERSION_base */ | ||
/* package hspec-2.10.6 */ | ||
#ifndef VERSION_hspec | ||
#define VERSION_hspec "2.10.6" | ||
#endif /* VERSION_hspec */ | ||
#ifndef MIN_VERSION_hspec | ||
#define MIN_VERSION_hspec(major1,major2,minor) (\ | ||
(major1) < 2 || \ | ||
(major1) == 2 && (major2) < 10 || \ | ||
(major1) == 2 && (major2) == 10 && (minor) <= 6) | ||
#endif /* MIN_VERSION_hspec */ | ||
|
||
/* tool gcc-10.2.0 */ | ||
#ifndef TOOL_VERSION_gcc | ||
#define TOOL_VERSION_gcc "10.2.0" | ||
#endif /* TOOL_VERSION_gcc */ | ||
#ifndef MIN_TOOL_VERSION_gcc | ||
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\ | ||
(major1) < 10 || \ | ||
(major1) == 10 && (major2) < 2 || \ | ||
(major1) == 10 && (major2) == 2 && (minor) <= 0) | ||
#endif /* MIN_TOOL_VERSION_gcc */ | ||
/* tool ghc-9.2.1 */ | ||
#ifndef TOOL_VERSION_ghc | ||
#define TOOL_VERSION_ghc "9.2.1" | ||
#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) <= 1) | ||
#endif /* MIN_TOOL_VERSION_ghc */ | ||
/* tool ghc-pkg-9.2.1 */ | ||
#ifndef TOOL_VERSION_ghc_pkg | ||
#define TOOL_VERSION_ghc_pkg "9.2.1" | ||
#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) <= 1) | ||
#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 runghc-9.2.1 */ | ||
#ifndef TOOL_VERSION_runghc | ||
#define TOOL_VERSION_runghc "9.2.1" | ||
#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) <= 1) | ||
#endif /* MIN_TOOL_VERSION_runghc */ | ||
/* tool strip-2.34 */ | ||
#ifndef TOOL_VERSION_strip | ||
#define TOOL_VERSION_strip "2.34" | ||
#endif /* TOOL_VERSION_strip */ | ||
#ifndef MIN_TOOL_VERSION_strip | ||
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\ | ||
(major1) < 2 || \ | ||
(major1) == 2 && (major2) < 34 || \ | ||
(major1) == 2 && (major2) == 34 && (minor) <= 0) | ||
#endif /* MIN_TOOL_VERSION_strip */ | ||
|
||
#ifndef CURRENT_PACKAGE_KEY | ||
#define CURRENT_PACKAGE_KEY "composing-0.1.0.0-inplace" | ||
#endif /* CURRENT_packageKey */ | ||
#ifndef CURRENT_COMPONENT_ID | ||
#define CURRENT_COMPONENT_ID "composing-0.1.0.0-inplace" | ||
#endif /* CURRENT_COMPONENT_ID */ | ||
#ifndef CURRENT_PACKAGE_VERSION | ||
#define CURRENT_PACKAGE_VERSION "0.1.0.0" | ||
#endif /* CURRENT_PACKAGE_VERSION */ |
Binary file added
BIN
+17.5 KB
...e/build/x86_64-windows/ghc-9.2.1/composing-0.1.0.0/build/libHScomposing-0.1.0.0-inplace.a
Binary file not shown.
Binary file added
BIN
+509 Bytes
...omposing Types/dist-newstyle/build/x86_64-windows/ghc-9.2.1/composing-0.1.0.0/cache/build
Binary file not shown.
Binary file added
BIN
+4.88 KB
...mposing Types/dist-newstyle/build/x86_64-windows/ghc-9.2.1/composing-0.1.0.0/cache/config
Binary file not shown.
Binary file added
BIN
+1.82 KB
...g Types/dist-newstyle/build/x86_64-windows/ghc-9.2.1/composing-0.1.0.0/cache/registration
Binary file not shown.
Binary file added
BIN
+40 Bytes
...style/build/x86_64-windows/ghc-9.2.1/composing-0.1.0.0/package.conf.inplace/package.cache
Binary file not shown.
Empty file.
Binary file added
BIN
+294 KB
...mposing Types/dist-newstyle/build/x86_64-windows/ghc-9.2.1/composing-0.1.0.0/setup-config
Binary file not shown.
Binary file added
BIN
+24.3 KB
Haskell Excercises & Code/Chapter25 - Composing Types/dist-newstyle/cache/compiler
Binary file not shown.
Binary file added
BIN
+3.67 KB
Haskell Excercises & Code/Chapter25 - Composing Types/dist-newstyle/cache/config
Binary file not shown.
Binary file added
BIN
+327 KB
Haskell Excercises & Code/Chapter25 - Composing Types/dist-newstyle/cache/elaborated-plan
Binary file not shown.
Binary file added
BIN
+627 KB
Haskell Excercises & Code/Chapter25 - Composing Types/dist-newstyle/cache/improved-plan
Binary file not shown.
1 change: 1 addition & 0 deletions
1
Haskell Excercises & Code/Chapter25 - Composing Types/dist-newstyle/cache/plan.json
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+270 KB
Haskell Excercises & Code/Chapter25 - Composing Types/dist-newstyle/cache/solver-plan
Binary file not shown.
Binary file added
BIN
+11.7 KB
Haskell Excercises & Code/Chapter25 - Composing Types/dist-newstyle/cache/source-hashes
Binary file not shown.
Binary file added
BIN
+1.73 KB
Haskell Excercises & Code/Chapter25 - Composing Types/dist-newstyle/cache/up-to-date
Binary file not shown.
34 changes: 34 additions & 0 deletions
34
...pter25 - Composing Types/dist-newstyle/packagedb/ghc-9.2.1/composing-0.1.0.0-inplace.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: composing | ||
version: 0.1.0.0 | ||
visibility: public | ||
id: composing-0.1.0.0-inplace | ||
key: composing-0.1.0.0-inplace | ||
maintainer: sky@isfalling.org | ||
author: Chicken Little | ||
category: Text | ||
abi: inplace | ||
exposed: True | ||
exposed-modules: EitherTT | ||
import-dirs: | ||
"C:\\Users\\Administrator\\Desktop\\Haskell first Principles\\haskell-deepidive\\Haskell Excercises & Code\\Chapter25 - Composing Types\\dist-newstyle\\build\\x86_64-windows\\ghc-9.2.1\\composing-0.1.0.0\\build" | ||
|
||
library-dirs: | ||
"C:\\Users\\Administrator\\Desktop\\Haskell first Principles\\haskell-deepidive\\Haskell Excercises & Code\\Chapter25 - Composing Types\\dist-newstyle\\build\\x86_64-windows\\ghc-9.2.1\\composing-0.1.0.0\\build" | ||
|
||
dynamic-library-dirs: | ||
"C:\\Users\\Administrator\\Desktop\\Haskell first Principles\\haskell-deepidive\\Haskell Excercises & Code\\Chapter25 - Composing Types\\dist-newstyle\\build\\x86_64-windows\\ghc-9.2.1\\composing-0.1.0.0\\build" | ||
|
||
data-dir: | ||
"C:\\Users\\Administrator\\Desktop\\Haskell first Principles\\haskell-deepidive\\Haskell Excercises & Code\\Chapter25 - Composing Types\\." | ||
|
||
hs-libraries: HScomposing-0.1.0.0-inplace | ||
include-dirs: C:\tools\msys64\mingw64\include | ||
depends: | ||
QuickCheck-2.14.2-a86079fca27e4995eff71586bc69486728d69c5d | ||
base-4.16.0.0 hspec-2.10.6-4755191b26c19bdcaf316d380b729c36bd3ac94c | ||
|
||
haddock-interfaces: | ||
"C:\\Users\\Administrator\\Desktop\\Haskell first Principles\\haskell-deepidive\\Haskell Excercises & Code\\Chapter25 - Composing Types\\dist-newstyle\\build\\x86_64-windows\\ghc-9.2.1\\composing-0.1.0.0\\doc\\html\\composing\\composing.haddock" | ||
|
||
haddock-html: | ||
"C:\\Users\\Administrator\\Desktop\\Haskell first Principles\\haskell-deepidive\\Haskell Excercises & Code\\Chapter25 - Composing Types\\dist-newstyle\\build\\x86_64-windows\\ghc-9.2.1\\composing-0.1.0.0\\doc\\html\\composing" |
Binary file added
BIN
+3.42 KB
...rcises & Code/Chapter25 - Composing Types/dist-newstyle/packagedb/ghc-9.2.1/package.cache
Binary file not shown.
Empty file.
30 changes: 30 additions & 0 deletions
30
Haskell Excercises & Code/Chapter25 - Composing Types/hasky.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Lines should be no longer than this length in characters. | ||
line_length_limit: 80 | ||
|
||
# How much to spread code over multiple lines instead of trying to fill a single | ||
# line. More precisely, this guides the ratio of "line_length_limit" to the | ||
# ribbon length (the number of characters on a line without leading and trailing | ||
# whitespace). Only the lowest value of 1 forces "line_length_limit" to be | ||
# applied strictly. | ||
# Reference: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.38.8777 | ||
ribbons_per_line: 1 | ||
|
||
# More than this number of empty lines in succession are merged. | ||
successive_empty_lines_limit: 1 | ||
|
||
# Indentation lengths in characters. | ||
indentations: | ||
class: 8 # "class" and "instance" declarations. | ||
do: 3 # "do" notation. | ||
case: 4 # Body of "case" expressions. | ||
let: 4 # Declarations in "let" expressions. | ||
where: 6 # Declarations in "where" clauses. | ||
onside: 2 # Continuation lines which would otherwise be offside. | ||
|
||
# Decides which parts of the code to sort. | ||
order: | ||
# Sequence of import declarations. | ||
import_declarations: true | ||
|
||
# Entities of import lists. | ||
import_entities: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters