stefan@stefans-MacBook-Pro curs3 % ghci ghci GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help Prelude> :l curs3.hs :l curs3.hs [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> :info Day :info Day type Day :: * data Day = Mon | Tue | Wed | Thu | Fri | Sat | Sun -- Defined at curs3.hs:21:1 *Main> :t nextDay :t nextDay nextDay :: Day -> Day *Main> 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 *Main> :t print :t print print :: Show a => a -> IO () *Main> :info Show :info Show type Show :: * -> Constraint class Show a where showsPrec :: Int -> a -> ShowS show :: a -> String showList :: [a] -> ShowS {-# MINIMAL showsPrec | show #-} -- Defined in ‘GHC.Show’ instance Show a => Show [a] -- Defined in ‘GHC.Show’ instance Show Word -- Defined in ‘GHC.Show’ instance Show GHC.Types.RuntimeRep -- Defined in ‘GHC.Show’ instance Show Ordering -- Defined in ‘GHC.Show’ instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ instance Show Integer -- Defined in ‘GHC.Show’ instance Show Int -- Defined in ‘GHC.Show’ instance Show Char -- Defined in ‘GHC.Show’ instance Show Bool -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l) => Show (a, b, c, d, e, f, g, h, i, j, k, l) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k) => Show (a, b, c, d, e, f, g, h, i, j, k) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j) => Show (a, b, c, d, e, f, g, h, i, j) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i) => Show (a, b, c, d, e, f, g, h, i) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h) => Show (a, b, c, d, e, f, g, h) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show (a, b, c, d, e, f, g) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d, Show e, Show f) => Show (a, b, c, d, e, f) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c, Show d) => Show (a, b, c, d) -- Defined in ‘GHC.Show’ instance (Show a, Show b, Show c) => Show (a, b, c) -- Defined in ‘GHC.Show’ instance (Show a, Show b) => Show (a, b) -- Defined in ‘GHC.Show’ instance Show () -- Defined in ‘GHC.Show’ instance (Show a, Show b) => Show (Either a b) -- Defined in ‘Data.Either’ instance Show Float -- Defined in ‘GHC.Float’ instance Show Double -- Defined in ‘GHC.Float’ *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> nextDay Mon nextDay Mon Tue *Main> nextDay (nextDay Mon) nextDay (nextDay Mon) Wed *Main> :i Bool :i Bool type Bool :: * data Bool = False | True -- Defined in ‘GHC.Types’ instance Eq Bool -- Defined in ‘GHC.Classes’ instance Ord Bool -- Defined in ‘GHC.Classes’ instance Enum Bool -- Defined in ‘GHC.Enum’ instance Show Bool -- Defined in ‘GHC.Show’ instance Read Bool -- Defined in ‘GHC.Read’ instance Bounded Bool -- Defined in ‘GHC.Enum’ *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> impartire 10 3 impartire 10 3 3 *Main> impartire 10 0 impartire 10 0 *** Exception: divide by zero *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> impartire 10 0 impartire 10 0 0 *Main> impartire 0 3 impartire 0 3 0 *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) curs3.hs:60:1: error: Duplicate type signatures for ‘impartire’ at curs3.hs:52:1-9 curs3.hs:60:1-9 | 60 | impartire :: Integer -> Integer -> Rezultat | ^^^^^^^^^ curs3.hs:61:1: error: Multiple declarations of ‘impartire’ Declared at: curs3.hs:53:1 curs3.hs:61:1 | 61 | impartire x y = if y == 0 then Invalid else Valid | ^^^^^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> impartire' 10 3 impartire' 10 3 :20:1: error: • No instance for (Show Rezultat) arising from a use of ‘print’ • In a stmt of an interactive GHCi command: print it *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> impartire' 10 3 impartire' 10 3 Valid *Main> impartire' 10 0 impartire' 10 0 Invalid *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> impartire' 10 3 impartire' 10 3 Valid 3 *Main> impartire' 12 3 impartire' 12 3 Valid 4 *Main> impartire' 12 0 impartire' 12 0 Invalid *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> impartireOk 12 0 impartireOk 12 0 False *Main> impartireOk 12 3 impartireOk 12 3 True *Main> :t Valid :t Valid Valid :: Integer -> Rezultat *Main> :t Invalid :t Invalid Invalid :: Rezultat *Main> Valid 3 Valid 3 Valid 3 *Main> Valid 10 Valid 10 Valid 10 *Main> :t Valid 10 :t Valid 10 Valid 10 :: Rezultat *Main> :t Invalid :t Invalid Invalid :: Rezultat *Main> P 4 5 P 4 5 :37:1: error: Data constructor not in scope: P :: t0 -> t1 -> t *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> P 3 4 P 3 4 P 3 4 *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> prima (P 3 4) prima (P 3 4) 3 *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) curs3.hs:103:1: error: The type signature for ‘adoua’ lacks an accompanying binding | 103 | adoua :: Pereche -> Integer | ^^^^^ curs3.hs:104:1: error: Multiple declarations of ‘prima’ Declared at: curs3.hs:101:1 curs3.hs:104:1 | 104 | prima (P x y) = y | ^^^^^ Failed, no modules loaded. Prelude>:r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> adoua (P 3 4) adoua (P 3 4) 4 *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> Vida Vida Vida *Main> Cons 4 Vidaq Cons 4 Vidaq :47:8: error: • Data constructor not in scope: Vidaq :: Lista • Perhaps you meant ‘Vida’ (line 121) *Main> Cons 4 Vida Cons 4 Vida Cons 4 Vida *Main> Cons 3 (Cons 4 (Cons 5 Vida)) Cons 3 (Cons 4 (Cons 5 Vida)) Cons 3 (Cons 4 (Cons 5 Vida)) *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> nrelem (Cons 3 (Cons 4 (Cons 5 Vida))) nrelem (Cons 3 (Cons 4 (Cons 5 Vida))) 3 *Main> nrelem Vida nrelem Vida 0 *Main> nrelem (Cons 3 Vida) nrelem (Cons 3 Vida) 1 *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> suma (Cons 3 (Cons 4 (Cons 5 Vida))) suma (Cons 3 (Cons 4 (Cons 5 Vida))) 12 *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) curs3.hs:133:19: error: • Couldn't match expected type ‘Integer’ with actual type ‘Int’ • In the first argument of ‘Cons’, namely ‘n’ In the expression: Cons n (primelen (n - 1)) In an equation for ‘primelen’: primelen n = Cons n (primelen (n - 1)) | 133 | primelen n = Cons n (primelen (n - 1)) | ^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> primelen 4 primelen 4 Cons 4 (Cons 3 (Cons 2 (Cons 1 Vida))) *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) curs3.hs:146:46: error: • Couldn't match expected type ‘ListaBool’ with actual type ‘Lista’ • In the first argument of ‘nrelemBool’, namely ‘tl’ In the second argument of ‘(+)’, namely ‘nrelemBool tl’ In the expression: 1 + nrelemBool tl | 146 | nrelemBool (ConsBool hd tl) = 1 + nrelemBool tl | ^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> nrelemBool (ConsBool True (ConsBool False VidaBool)) nrelemBool (ConsBool True (ConsBool False VidaBool)) 2 *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) curs3.hs:160:39: error: • Couldn't match expected type ‘List a0’ with actual type ‘Lista’ • In the first argument of ‘countElem’, namely ‘tl’ In the second argument of ‘(+)’, namely ‘countElem tl’ In the expression: 1 + countElem tl | 160 | countElem (Con hd tl) = 1 + countElem tl | ^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> countElem (Con True (Con False (Con True Emp))) countElem (Con True (Con False (Con True Emp))) 3 *Main> countElem (Con 'a' (Con 'b' (Con 'c' Emp))) countElem (Con 'a' (Con 'b' (Con 'c' Emp))) 3 *Main> countElem (Con 32 (Con 12 (Con 4 Emp))) countElem (Con 32 (Con 12 (Con 4 Emp))) 3 *Main> :info List :info List type List :: * -> * data List a = Emp | Con a (List a) -- Defined at curs3.hs:153:1 instance [safe] Show a => Show (List a) -- Defined at curs3.hs:153:45 *Main> :info Lista :info Lista type Lista :: * data Lista = Vida | Cons Integer Lista -- Defined at curs3.hs:121:1 instance [safe] Show Lista -- Defined at curs3.hs:121:49 *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) curs3.hs:163:10: error: • Couldn't match expected type ‘List Integer’ with actual type ‘Lista’ • In the pattern: Vida In an equation for ‘sumLista’: sumLista Vida = 0 | 163 | sumLista Vida = 0 | ^^^^ curs3.hs:164:11: error: • Couldn't match expected type ‘List Integer’ with actual type ‘Lista’ • In the pattern: Cons hd tl In an equation for ‘sumLista’: sumLista (Cons hd tl) = hd + suma tl | 164 | sumLista (Cons hd tl) = hd + suma tl | ^^^^^^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) curs3.hs:164:34: error: • Couldn't match expected type ‘Lista’ with actual type ‘List Integer’ • In the first argument of ‘suma’, namely ‘tl’ In the second argument of ‘(+)’, namely ‘suma tl’ In the expression: hd + suma tl | 164 | sumLista (Con hd tl) = hd + suma tl | ^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> sumLista (Con 3 (Con 4 Emp)) sumLista (Con 3 (Con 4 Emp)) 7 *Main> :info [] :info [] type [] :: * -> * data [] a = [] | a : [a] -- Defined in ‘GHC.Types’ instance Applicative [] -- Defined in ‘GHC.Base’ instance Eq a => Eq [a] -- Defined in ‘GHC.Classes’ instance Functor [] -- Defined in ‘GHC.Base’ instance Monad [] -- Defined in ‘GHC.Base’ instance Monoid [a] -- Defined in ‘GHC.Base’ instance Ord a => Ord [a] -- Defined in ‘GHC.Classes’ instance Semigroup [a] -- Defined in ‘GHC.Base’ instance Show a => Show [a] -- Defined in ‘GHC.Show’ instance MonadFail [] -- Defined in ‘Control.Monad.Fail’ instance Read a => Read [a] -- Defined in ‘GHC.Read’ instance Foldable [] -- Defined in ‘Data.Foldable’ instance Traversable [] -- Defined in ‘Data.Traversable’ *Main> :t [True, False] :t [True, False] [True, False] :: [Bool] *Main> :t ['a', 'c'] :t ['a', 'c'] ['a', 'c'] :: [Char] *Main> :info Eq :info Eq type Eq :: * -> Constraint class Eq a where (==) :: a -> a -> Bool (/=) :: a -> a -> Bool {-# MINIMAL (==) | (/=) #-} -- Defined in ‘GHC.Classes’ instance Eq a => Eq [a] -- Defined in ‘GHC.Classes’ instance Eq Word -- Defined in ‘GHC.Classes’ instance Eq Ordering -- Defined in ‘GHC.Classes’ instance Eq Int -- Defined in ‘GHC.Classes’ instance Eq Float -- Defined in ‘GHC.Classes’ instance Eq Double -- Defined in ‘GHC.Classes’ instance Eq Char -- Defined in ‘GHC.Classes’ instance Eq Bool -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b, Eq c) => Eq (a, b, c) -- Defined in ‘GHC.Classes’ instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’ instance Eq () -- Defined in ‘GHC.Classes’ instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Maybe’ instance (Eq a, Eq b) => Eq (Either a b) -- Defined in ‘Data.Either’ instance Eq Integer -- Defined in ‘integer-gmp-1.0.3.0:GHC.Integer.Type’ *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) curs3.hs:172:1: error: Multiple declarations of ‘List’ Declared at: curs3.hs:153:1 curs3.hs:172:1 | 172 | data List a = Emp | Con a (List a) deriving (Show, Eq) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ curs3.hs:172:15: error: Multiple declarations of ‘Emp’ Declared at: curs3.hs:153:15 curs3.hs:172:15 | 172 | data List a = Emp | Con a (List a) deriving (Show, Eq) | ^^^ curs3.hs:172:21: error: Multiple declarations of ‘Con’ Declared at: curs3.hs:153:21 curs3.hs:172:21 | 172 | data List a = Emp | Con a (List a) deriving (Show, Eq) | ^^^^^^^^^^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) curs3.hs:166:1: error: The type signature for ‘reverse’ lacks an accompanying binding (The type signature must be given where ‘reverse’ is declared) | 166 | reverse :: List a -> List a | ^^^^^^^ curs3.hs:169:1: error: The type signature for ‘convert’ lacks an accompanying binding | 169 | convert :: List a -> [a] | ^^^^^^^ curs3.hs:170:1: error: The type signature for ‘convert'’ lacks an accompanying binding | 170 | convert' :: [a] -> List a | ^^^^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> Con 3 Emp == Con 4 Emp Con 3 Emp == Con 4 Emp False *Main> Con 3 Emp == Con 3 Emp Con 3 Emp == Con 3 Emp True *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> Con 3 Emp == Con 3 Emp Con 3 Emp == Con 3 Emp :83:1: error: • No instance for (Eq (List Integer)) arising from a use of ‘==’ • In the expression: Con 3 Emp == Con 3 Emp In an equation for ‘it’: it = Con 3 Emp == Con 3 Emp *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> Suma (Suma (Const 3.4) (Const 1)) (Const 2) Suma (Suma (Const 3.4) (Const 1)) (Const 2) Suma (Suma (Const 3.4) (Const 1.0)) (Const 2.0) *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> eval (Suma (Suma (Const 3.4) (Const 1)) (Const 2)) eval (Suma (Suma (Const 3.4) (Const 1)) (Const 2)) 6.4 *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> eval (Suma (Produs (Const 3.4) (Const 4.5)) (Const 2)) eval (Suma (Produs (Const 3.4) (Const 4.5)) (Const 2)) 17.3 *Main> 3.4 * 4.5 3.4 * 4.5 15.299999999999999 *Main> 3.4 * 4.5 + 2 3.4 * 4.5 + 2 17.299999999999997 *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> Suma (Produs (Var 'x') (Var 'x')) (Const 1) Suma (Produs (Var 'x') (Var 'x')) (Const 1) :94:19: error: • Couldn't match type ‘Char’ with ‘[Char]’ Expected type: String Actual type: Char • In the first argument of ‘Var’, namely ‘'x'’ In the first argument of ‘Produs’, namely ‘(Var 'x')’ In the first argument of ‘Suma’, namely ‘(Produs (Var 'x') (Var 'x'))’ :94:29: error: • Couldn't match type ‘Char’ with ‘[Char]’ Expected type: String Actual type: Char • In the first argument of ‘Var’, namely ‘'x'’ In the second argument of ‘Produs’, namely ‘(Var 'x')’ In the first argument of ‘Suma’, namely ‘(Produs (Var 'x') (Var 'x'))’ *Main> Suma (Produs (Var "x") (Var "x")) (Const 1) Suma (Produs (Var "x") (Var "x")) (Const 1) Suma (Produs (Var "x") (Var "x")) (Const 1.0) *Main> eval Suma (Produs (Var "x") (Var "x")) (Const 1) eval Suma (Produs (Var "x") (Var "x")) (Const 1) :96:1: error: • Couldn't match expected type ‘Exp -> Exp -> t’ with actual type ‘Float’ • The function ‘eval’ is applied to three arguments, but its type ‘Exp -> Float’ has only one In the expression: eval Suma (Produs (Var "x") (Var "x")) (Const 1) In an equation for ‘it’: it = eval Suma (Produs (Var "x") (Var "x")) (Const 1) • Relevant bindings include it :: t (bound at :96:1) :96:6: error: • Couldn't match expected type ‘Exp’ with actual type ‘Exp -> Exp -> Exp’ • Probable cause: ‘Suma’ is applied to too few arguments In the first argument of ‘eval’, namely ‘Suma’ In the expression: eval Suma (Produs (Var "x") (Var "x")) (Const 1) In an equation for ‘it’: it = eval Suma (Produs (Var "x") (Var "x")) (Const 1) *Main> eval (Suma (Produs (Var "x") (Var "x")) (Const 1)) eval (Suma (Produs (Var "x") (Var "x")) (Const 1)) 1.0 *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) curs3.hs:192:22: error: parse error on input ‘|’ | 192 | | (Const x, Const y) -> Const (x + y) | ^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) curs3.hs:193:22: error: parse error on input ‘|’ | 193 | | (Const 0, _) -> e2' | ^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> :r :r Ok, one module loaded. *Main> eval (Suma (Suma (Var "x") (Const 0)) (Const 3)) eval (Suma (Suma (Var "x") (Const 0)) (Const 3)) 3.0 *Main> simpl (Suma (Suma (Var "x") (Const 0)) (Const 3)) simpl (Suma (Suma (Var "x") (Const 0)) (Const 3)) Suma (Var "x") (Const 3.0) *Main> :r :r [1 of 1] Compiling Main ( curs3.hs, interpreted ) Ok, one module loaded. *Main> eval (Produs (Suma (Var "x") (Const 0)) (Const 3)) eval (Produs (Suma (Var "x") (Const 0)) (Const 3)) 0.0 *Main> simpl (Produs (Suma (Var "x") (Const 0)) (Const 3)) simpl (Produs (Suma (Var "x") (Const 0)) (Const 3)) Produs (Var "x") (Const 3.0) *Main>