λ> Foo 10 :11:1-3: Not in scope: data constructor ‘Foo’ λ> :l p4.hs [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> Foo 10 Foo 10 λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> :t Cons Cons :: Int -> MyList -> MyList λ> Cons 10 Nil Cons 10 Nil λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> list2mylist [1,2,4,5,7] Cons 1 (Cons 2 (Cons 4 (Cons 5 (Cons 7 Nil)))) λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> l2ml [2,3,4,5] Cons 2 (Cons 3 (Cons 4 (Cons 5 Nil))) λ> :t Cons Cons :: Int -> MyList -> MyList λ> :t assoc :1:1-5: Not in scope: ‘assoc’ λ> :t lookup lookup :: Eq a => a -> [(a, b)] -> Maybe b λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> assoc "Jenni" 8675309 [] [("Jenni",8675309)] λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> :t assoc assoc :: Ord a => a -> t -> [(a, t)] -> [(a, t)] λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> Nil == Nil True λ> :t (<) (<) :: Ord a => a -> a -> Bool λ> lookup "Jenni" [("Jenni",8675309)] Just 8675309 λ> lookup "Bill" [("Jenni",8675309)] Nothing λ> :t lookup lookup :: Eq a => a -> [(a, b)] -> Maybe b λ> :t id id :: a -> a λ> id 10 10 λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) p4.hs:24:19: parse error on input ‘@’ Failed, modules loaded: none. λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) p4.hs:29:14-16: Illegal type signature: ‘Int’ Perhaps you intended to use ScopedTypeVariables In a pattern type-signature Failed, modules loaded: none. λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> :t plus plus :: Num a => a -> a -> a λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> maybePlus (Just 10) (Just 2) Just 12 λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> maybeMap (Just (+1)) [2,3,4] [3,4,5] λ> :t maybeMap maybeMap :: Maybe (b -> b) -> [b] -> [b] λ> :t map map :: (a -> b) -> [a] -> [b] λ> maybeMap (Just 1) [2,3,4] :69:1-25: Non type-variable argument in the constraint: Num (b -> b) (Use FlexibleContexts to permit this) When checking that ‘it’ has the inferred type it :: forall b. (Num b, Num (b -> b)) => [b] λ> :t maybeMap maybeMap :: Maybe (b -> b) -> [b] -> [b] λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> lift (+) (Just 10) (Just 30) Just 40 λ> let jplus = lift (+) λ> jplus (Just 10) (Just 30) Just 40 λ> zipWith [Just 10, Nothing, Just 40] [Nothing, Just 40, Just 9] :78:9-35: Couldn't match expected type ‘Maybe Integer -> b -> c’ with actual type ‘[Maybe Integer]’ Relevant bindings include it :: [b] -> [c] (bound at :78:1) In the first argument of ‘zipWith’, namely ‘[Just 10, Nothing, Just 40]’ In the expression: zipWith [Just 10, Nothing, Just 40] [Nothing, Just 40, Just 9] In an equation for ‘it’: it = zipWith [Just 10, Nothing, Just 40] [Nothing, Just 40, Just 9] λ> zipWith jplus [Just 10, Nothing, Just 40] [Nothing, Just 40, Just 9] [Nothing,Nothing,Just 49] λ> :t lift lift :: (t -> t1 -> r) -> Maybe t -> Maybe t1 -> Maybe r λ> :t jplus jplus :: Num r => Maybe r -> Maybe r -> Maybe r λ> lift lift :: (t -> t1 -> r) -> Maybe t -> Maybe t1 -> Maybe r λ> let jinc = jplus (Just 1) λ> jinc (Just 123) Just 124 λ> :r [1 of 1] Compiling Main ( p4.hs, interpreted ) Ok, modules loaded: Main. λ> let p12 = fliplift (Just 10) (Just 20) λ> p12 (+) Just 30 λ> p12 (*) Just 200 λ> let jlookup = lift lookup λ> jlookup (Just "Jenni") (Just []) Just Nothing