stefan@stefans-MBP week03 % ghci ghci GHCi, version 9.4.8: https://www.haskell.org/ghc/ :? for help macro 'doc' overwrites builtin command. Use ':def!' to overwrite. Loaded GHCi configuration from /Users/stefan/.ghci ghci> :l week03 :l week03 [1 of 2] Compiling Main ( week03.hs, interpreted ) Ok, one module loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> :t nextDay :t nextDay nextDay :: Day -> Day ghci> ghci> nextDay Mon nextDay Mon :5:1: error: • No instance for (Show Day) arising from a use of ‘print’ • In a stmt of an interactive GHCi command: print it ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> nextDay Mon nextDay Mon Tue ghci> nextDay (nextDay Mon) nextDay (nextDay Mon) Wed ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> MyFalse MyFalse MyFalse ghci> :t MyFalse :t MyFalse MyFalse :: MyBool ghci> :t MyTrue :t MyTrue MyTrue :: MyBool ghci> :info Bool :info Bool type Bool :: * data Bool = False | True -- Defined in ‘GHC.Types’ instance Bounded Bool -- Defined in ‘GHC.Enum’ instance Read Bool -- Defined in ‘GHC.Read’ instance Enum Bool -- Defined in ‘GHC.Enum’ instance Show Bool -- Defined in ‘GHC.Show’ instance Eq Bool -- Defined in ‘GHC.Classes’ instance Ord Bool -- Defined in ‘GHC.Classes’ ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> myAnd MyFalse MyTrue myAnd MyFalse MyTrue MyFalse ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> convert (myAnd MyFalse MyTrue) convert (myAnd MyFalse MyTrue) False ghci> :reload :reload [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] week03.hs:29:1: error: Multiple declarations of ‘convert’ Declared at: week03.hs:25:1 week03.hs:29:1 | 29 | convert False = MyFalse | ^^^^^^^ Failed, no modules loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) Ok, one module loaded. ghci> convert' (True && False) convert' (True && False) MyFalse ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> division 10 3 division 10 3 3 ghci> division 12 3 division 12 3 4 ghci> division (-12) 3 division (-12) 3 -4 ghci> division (-12) (-3) division (-12) (-3) 4 ghci> division 10 0 division 10 0 *** Exception: divide by zero ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> computation 6 8 2 computation 6 8 2 10 ghci> computation 6 8 0 computation 6 8 0 *** Exception: divide by zero ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> computation' 6 8 2 computation' 6 8 2 10 ghci> computation' 6 8 0 computation' 6 8 0 0 ghci> division' 0 100 division' 0 100 0 ghci> division' 10 0 division' 10 0 0 ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> computation'' 6 8 2 computation'' 6 8 2 10 ghci> computation'' 6 8 0 computation'' 6 8 0 6 ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> computation''' 6 8 2 computation''' 6 8 2 10 ghci> computation''' 6 8 0 computation''' 6 8 0 6 ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> division4 10 2 division4 10 2 Valid 5 ghci> division4 10 0 division4 10 0 Invalid ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> wasItValid (division4 10 0) wasItValid (division4 10 0) False ghci> wasItValid (division4 10 2) wasItValid (division4 10 2) True ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> computation4 6 8 2 computation4 6 8 2 10 ghci> ghci> computation4 6 8 0 computation4 6 8 0 6 ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] week03.hs:99:27: error: parse error on input ‘deriving’ | 99 | datatype Pair = P Int Int deriving Show | ^^^^^^^^ Failed, no modules loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) Ok, one module loaded. ghci> makePair 3 4 makePair 3 4 P 3 4 ghci> fstPair (makePair 3 4) fstPair (makePair 3 4) 3 ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] week03.hs:108:11: error: Parse error in pattern: makePair | 108 | fstPair' (makePair x _) = x | ^^^^^^^^^^^^ Failed, no modules loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) Ok, one module loaded. ghci> A A A ghci> :type A :type A A :: Mystery ghci> B 23 A B 23 A B 23 A ghci> B 42 (B 23 A) B 42 (B 23 A) B 42 (B 23 A) ghci> B 100 (B 42 (B 23 A)) B 100 (B 42 (B 23 A)) B 100 (B 42 (B 23 A)) ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> Cons 100 (Cons 42 (Cons 23 Empty)) Cons 100 (Cons 42 (Cons 23 Empty)) Cons 100 (Cons 42 (Cons 23 Empty)) ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> count (Cons 100 (Cons 42 (Cons 23 Empty))) count (Cons 100 (Cons 42 (Cons 23 Empty))) 3 ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> sumAll (Cons 100 (Cons 42 (Cons 23 Empty))) sumAll (Cons 100 (Cons 42 (Cons 23 Empty))) 165 ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] week03.hs:135:1: error: Multiple declarations of ‘count’ Declared at: week03.hs:127:1 week03.hs:135:1 | 135 | count list = countAux list 0 | ^^^^^ Failed, no modules loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) Ok, one module loaded. ghci> count' (Cons 100 (Cons 42 (Cons 23 Empty))) count' (Cons 100 (Cons 42 (Cons 23 Empty))) 3:r ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> 3:r 3:r :72:3: error: Variable not in scope: r :: [a] ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> computePass (Cons 100 (Cons 42 (Cons 23 Empty))) computePass (Cons 100 (Cons 42 (Cons 23 Empty))) Cons' True (Cons' False (Cons' False Empty')) ghci> count (Cons' True (Cons' False (Cons' False Empty'))) count (Cons' True (Cons' False (Cons' False Empty'))) :75:8: error: • Couldn't match expected type ‘List’ with actual type ‘List'’ • In the first argument of ‘count’, namely ‘(Cons' True (Cons' False (Cons' False Empty')))’ In the expression: count (Cons' True (Cons' False (Cons' False Empty'))) In an equation for ‘it’: it = count (Cons' True (Cons' False (Cons' False Empty'))) ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> count1 (Cons' True (Cons' False (Cons' False Empty'))) count1 (Cons' True (Cons' False (Cons' False Empty'))) 3 ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] week03.hs:171:39: error: • Expecting one more argument to ‘ParList’ Expected a type, but ‘ParList’ has kind ‘* -> *’ • In the type ‘ParList’ In the definition of data constructor ‘ParCons’ In the data declaration for ‘ParList’ | 171 | data ParList a = ParEmpty | ParCons a ParList deriving Show | ^^^^^^^ Failed, no modules loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) Ok, one module loaded. ghci> parCount (ParCons True (ParCons False (ParCons False ParEmpty))) parCount (ParCons True (ParCons False (ParCons False ParEmpty))) 3 ghci> parCount (ParCons 1 (ParCons 42 (ParCons 2 ParEmpty))) parCount (ParCons 1 (ParCons 42 (ParCons 2 ParEmpty))) 3 ghci> :type (ParCons True (ParCons False (ParCons False ParEmpty))) :type (ParCons True (ParCons False (ParCons False ParEmpty))) (ParCons True (ParCons False (ParCons False ParEmpty))) :: ParList Bool ghci> parCount (ParCons 'a' (ParCons 'b' (ParCons 'e' ParEmpty))) parCount (ParCons 'a' (ParCons 'b' (ParCons 'e' ParEmpty))) 3 ghci> :type (ParCons 'a' (ParCons 'b' (ParCons 'e' ParEmpty))) :type (ParCons 'a' (ParCons 'b' (ParCons 'e' ParEmpty))) (ParCons 'a' (ParCons 'b' (ParCons 'e' ParEmpty))) :: ParList Char ghci> :type (ParCons 1 (ParCons 42 (ParCons 2 ParEmpty))) :type (ParCons 1 (ParCons 42 (ParCons 2 ParEmpty))) (ParCons 1 (ParCons 42 (ParCons 2 ParEmpty))) :: Num a => ParList a ghci> :i Num :i Num type Num :: * -> Constraint class Num a where (+) :: a -> a -> a (-) :: a -> a -> a (*) :: a -> a -> a negate :: a -> a abs :: a -> a signum :: a -> a fromInteger :: Integer -> a {-# MINIMAL (+), (*), abs, signum, fromInteger, (negate | (-)) #-} -- Defined in ‘GHC.Num’ instance Num Double -- Defined in ‘GHC.Float’ instance Num Float -- Defined in ‘GHC.Float’ instance Num Int -- Defined in ‘GHC.Num’ instance Num Integer -- Defined in ‘GHC.Num’ instance Num Word -- Defined in ‘GHC.Num’ ghci> parCount (ParCons 'a' (ParCons 42 (ParCons True ParEmpty))) parCount (ParCons 'a' (ParCons 42 (ParCons True ParEmpty))) :90:44: error: • Couldn't match expected type ‘Char’ with actual type ‘Bool’ • In the first argument of ‘ParCons’, namely ‘True’ In the second argument of ‘ParCons’, namely ‘(ParCons True ParEmpty)’ In the second argument of ‘ParCons’, namely ‘(ParCons 42 (ParCons True ParEmpty))’ ghci> :type (ParCons 'a' (ParCons 42 (ParCons True ParEmpty))) :type (ParCons 'a' (ParCons 42 (ParCons True ParEmpty))) :1:35: error: • Couldn't match expected type ‘Char’ with actual type ‘Bool’ • In the first argument of ‘ParCons’, namely ‘True’ In the second argument of ‘ParCons’, namely ‘(ParCons True ParEmpty)’ In the second argument of ‘ParCons’, namely ‘(ParCons 42 (ParCons True ParEmpty))’ ghci> :type (ParCons True ParEmpty) :type (ParCons True ParEmpty) (ParCons True ParEmpty) :: ParList Bool ghci> :type (ParCons 42 (ParCons True ParEmpty)) :type (ParCons 42 (ParCons True ParEmpty)) :1:10: error: • No instance for (Num Bool) arising from the literal ‘42’ • In the first argument of ‘ParCons’, namely ‘42’ In the expression: ParCons 42 (ParCons True ParEmpty) ghci> :i [] :i [] type [] :: * -> * data [] a = [] | a : [a] -- Defined in ‘GHC.Types’ instance Traversable [] -- Defined in ‘Data.Traversable’ instance MonadFail [] -- Defined in ‘Control.Monad.Fail’ instance Monoid [a] -- Defined in ‘GHC.Base’ instance Semigroup [a] -- Defined in ‘GHC.Base’ instance Foldable [] -- Defined in ‘Data.Foldable’ instance Read a => Read [a] -- Defined in ‘GHC.Read’ instance Applicative [] -- Defined in ‘GHC.Base’ instance Functor [] -- Defined in ‘GHC.Base’ instance Monad [] -- Defined in ‘GHC.Base’ instance Eq a => Eq [a] -- Defined in ‘GHC.Classes’ instance Ord a => Ord [a] -- Defined in ‘GHC.Classes’ instance Show a => Show [a] -- Defined in ‘GHC.Show’ ghci> [ 1, 2, 3 ] [ 1, 2, 3 ] [1,2,3] ghci> [ True, False, False ] [ True, False, False ] [True,False,False] ghci> [] [] [] ghci> 1 : [] 1 : [] [1] ghci> 2 : (1 : []) 2 : (1 : []) [2,1] ghci> 1 : (2 : (3 : [])) 1 : (2 : (3 : [])) [1,2,3] ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> countList (1 : (2 : (3 : []))) countList (1 : (2 : (3 : []))) 3 ghci> countList ] countList ] :103:11: error: parse error on input ‘]’ ghci> countList [True, False, False] countList [True, False, False] 3 ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> qs [4,8,7,6,2,9,0,2,6,7] qs [4,8,7,6,2,9,0,2,6,7] [0,2,2,4,6,6,7,7,8,9] ghci> :type [ [] , [1,2] , [42,5,8] , [3] ] :type [ [] , [1,2] , [42,5,8] , [3] ] [ [] , [1,2] , [42,5,8] , [3] ] :: Num a => [[a]] ghci> countList [ [] , [1,2] , [42,5,8] , [3] ] countList [ [] , [1,2] , [42,5,8] , [3] ] 4 ghci> :type [ 'a', 'b' ] : ( [ True, False ] : [] ) :type [ 'a', 'b' ] : ( [ True, False ] : [] ) :1:20: error: • Couldn't match expected type ‘Char’ with actual type ‘Bool’ • In the expression: True In the first argument of ‘(:)’, namely ‘[True, False]’ In the second argument of ‘(:)’, namely ‘([True, False] : [])’ :1:26: error: • Couldn't match expected type ‘Char’ with actual type ‘Bool’ • In the expression: False In the first argument of ‘(:)’, namely ‘[True, False]’ In the second argument of ‘(:)’, namely ‘([True, False] : [])’ ghci> :type ( [ True, False ] : [] ) :type ( [ True, False ] : [] ) ( [ True, False ] : [] ) :: [[Bool]] ghci> "asdf" "asdf" "asdf" ghci> ['a', 's', 'd', 'f'] ['a', 's', 'd', 'f'] "asdf" ghci> :type ['a', 's', 'd', 'f'] :type ['a', 's', 'd', 'f'] ['a', 's', 'd', 'f'] :: [Char] ghci> :type "asdf" :type "asdf" "asdf" :: String ghci> ['a', 's', 'd', 'f'] == "asdf" ['a', 's', 'd', 'f'] == "asdf" True ghci> :i String :i String type String :: * type String = [Char] -- Defined in ‘GHC.Base’ ghci> "" :: Char "" :: Char :117:1: error: • Couldn't match type ‘[Char]’ with ‘Char’ Expected: Char Actual: String • In the expression: "" :: Char In an equation for ‘it’: it = "" :: Char ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> firstChar "asdf" firstChar "asdf" ValidChar 'a' ghci> firstChar "" firstChar "" InvalidChar ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> firstChar' "asdf" firstChar' "asdf" Some 'a' ghci> firstChar' "" firstChar' "" None ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> division5 10 2 division5 10 2 Some 5 ghci> division5 10 0 division5 10 0 None ghci> :info Maybe :info Maybe type Maybe :: * -> * data Maybe a = Nothing | Just a -- Defined in ‘GHC.Maybe’ instance Traversable Maybe -- Defined in ‘Data.Traversable’ instance MonadFail Maybe -- Defined in ‘Control.Monad.Fail’ instance Foldable Maybe -- Defined in ‘Data.Foldable’ instance Applicative Maybe -- Defined in ‘GHC.Base’ instance Functor Maybe -- Defined in ‘GHC.Base’ instance Monad Maybe -- Defined in ‘GHC.Base’ instance Semigroup a => Monoid (Maybe a) -- Defined in ‘GHC.Base’ instance Semigroup a => Semigroup (Maybe a) -- Defined in ‘GHC.Base’ instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Maybe’ instance Ord a => Ord (Maybe a) -- Defined in ‘GHC.Maybe’ instance Read a => Read (Maybe a) -- Defined in ‘GHC.Read’ instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> firstChar'' "asdf" firstChar'' "asdf" Just 'a' ghci> firstChar'' "" firstChar'' "" Nothing ghci> division6 10 2 division6 10 2 Just 5 ghci> division6 10 0 division6 10 0 Nothing ghci> :i Either :i Either type Either :: * -> * -> * data Either a b = Left a | Right b -- Defined in ‘Data.Either’ instance Traversable (Either a) -- Defined in ‘Data.Traversable’ instance Foldable (Either a) -- Defined in ‘Data.Foldable’ instance Applicative (Either e) -- Defined in ‘Data.Either’ instance Functor (Either a) -- Defined in ‘Data.Either’ instance Monad (Either e) -- Defined in ‘Data.Either’ instance Semigroup (Either a b) -- Defined in ‘Data.Either’ instance (Eq a, Eq b) => Eq (Either a b) -- Defined in ‘Data.Either’ instance (Ord a, Ord b) => Ord (Either a b) -- Defined in ‘Data.Either’ instance (Read a, Read b) => Read (Either a b) -- Defined in ‘Data.Either’ instance (Show a, Show b) => Show (Either a b) -- Defined in ‘Data.Either’ ghci> sqrt 10 sqrt 10 3.1622776601683795 ghci> floor (sqrt 10) floor (sqrt 10) 3 ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] week03.hs:218:1: error: Multiple declarations of ‘computation’ Declared at: week03.hs:43:1 week03.hs:218:1 | 218 | computation x y = Left (floor (sqrt (x `div` y))) | ^^^^^^^^^^^ Failed, no modules loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) week03.hs:217:42: error: Not in scope: type constructor or class ‘Exc’ | 217 | computation1 :: Int -> Int -> Either Int Exc | ^^^ Failed, no modules loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) week03.hs:218:26: error: • No instance for (RealFrac Int) arising from a use of ‘floor’ • In the first argument of ‘Left’, namely ‘(floor (sqrt (x `div` y)))’ In the expression: Left (floor (sqrt (x `div` y))) In an equation for ‘computation1’: computation1 x y = Left (floor (sqrt (x `div` y))) | 218 | computation1 x y = Left (floor (sqrt (x `div` y))) | ^^^^^ week03.hs:218:33: error: • No instance for (Floating Int) arising from a use of ‘sqrt’ • In the first argument of ‘floor’, namely ‘(sqrt (x `div` y))’ In the first argument of ‘Left’, namely ‘(floor (sqrt (x `div` y)))’ In the expression: Left (floor (sqrt (x `div` y))) | 218 | computation1 x y = Left (floor (sqrt (x `div` y))) | ^^^^ Failed, no modules loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) week03.hs:218:52: error: • Couldn't match expected type ‘Integer’ with actual type ‘Int’ • In the first argument of ‘div’, namely ‘x’ In the first argument of ‘fromInteger’, namely ‘(x `div` y)’ In the first argument of ‘sqrt’, namely ‘(fromInteger (x `div` y))’ | 218 | computation1 x y = Left (floor (sqrt (fromInteger (x `div` y)))) | ^ week03.hs:218:60: error: • Couldn't match expected type ‘Integer’ with actual type ‘Int’ • In the second argument of ‘div’, namely ‘y’ In the first argument of ‘fromInteger’, namely ‘(x `div` y)’ In the first argument of ‘sqrt’, namely ‘(fromInteger (x `div` y))’ | 218 | computation1 x y = Left (floor (sqrt (fromInteger (x `div` y)))) | ^ Failed, no modules loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) Ok, one module loaded. ghci> computation1 10 2 computation1 10 2 :141:1: error: • No instance for (Show MyExc) arising from a use of ‘print’ • In a stmt of an interactive GHCi command: print it ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> computation1 10 2 computation1 10 2 Left 2 ghci> computation1 10 0 computation1 10 0 Left *** Exception: divide by zero ghci> computation1 (-10) 1 computation1 (-10) 1 Left 0 ghci> sqrt (-10) sqrt (-10) NaN ghci> floor (sqrt (-10)) floor (sqrt (-10)) -269653970229347386159395778618353710042696546841345985910145121736599013708251444699062715983611304031680170819807090036488184653221624933739271145959211186566651840137298227914453329401869141179179624428127508653257226023513694322210869665811240855745025766026879447359920868907719574457253034494436336205824 ghci> (-10) `div` 1 (-10) `div` 1 -10 ghci> sqrt (fromInteger ((-10) `div` 1)) sqrt (fromInteger ((-10) `div` 1)) NaN ghci> floor (sqrt (fromInteger ((-10) `div` 1))) floor (sqrt (fromInteger ((-10) `div` 1))) -269653970229347386159395778618353710042696546841345985910145121736599013708251444699062715983611304031680170819807090036488184653221624933739271145959211186566651840137298227914453329401869141179179624428127508653257226023513694322210869665811240855745025766026879447359920868907719574457253034494436336205824 ghci> computation1 (-10) 1 computation1 (-10) 1 Left 0 ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] Ok, one module loaded. ghci> computation1 (-10) 1 computation1 (-10) 1 Left (-269653970229347386159395778618353710042696546841345985910145121736599013708251444699062715983611304031680170819807090036488184653221624933739271145959211186566651840137298227914453329401869141179179624428127508653257226023513694322210869665811240855745025766026879447359920868907719574457253034494436336205824) ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) [Source file changed] week03.hs:223:24: error: • Couldn't match expected type: t0 -> Either Integer MyExc with actual type: Either (a0 -> b1) b0 • The function ‘Left’ is applied to two value arguments, but its type ‘(a0 -> b1) -> Either (a0 -> b1) b0’ has only one In the expression: Left floor (sqrt result) In the expression: if result < 0 then Right SquareRootOfNegative else Left floor (sqrt result) • Relevant bindings include result :: t0 (bound at week03.hs:219:24) | 223 | Left floor (sqrt result) | ^^^^^^^^^^^^^^^^^^^^^^^^ Failed, no modules loaded. ghci> :r :r [1 of 2] Compiling Main ( week03.hs, interpreted ) Ok, one module loaded. ghci> computation1 (-10) 1 computation1 (-10) 1 Right SquareRootOfNegative ghci> computation1 (-10) 0 computation1 (-10) 0 Right DivisionByZero ghci> computation1 (-10) 2 computation1 (-10) 2 Right SquareRootOfNegative ghci> computation1 10 2 computation1 10 2 Left 2 ghci>