Last login: Tue Feb 26 20:27:59 on ttys006 : ~ ; exec /Users/dmason/fs/Courses/cps506/Lectures/Haskell/ghci.sh GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling February27 ( lecture.hs, interpreted ) Ok, modules loaded: February27. *February27> let a = 7 *February27> let f x = x + 5 *February27> f a 12 *February27> let id x = x *February27> f :6:1: No instance for (Show (a0 -> a0)) (maybe you haven't applied enough arguments to a function?) arising from a use of ‘print’ In the first argument of ‘print’, namely ‘it’ In a stmt of an interactive GHCi command: print it *February27> :t f f :: Num a => a -> a *February27> f [] :8:1: Non type-variable argument in the constraint: Num [t] (Use FlexibleContexts to permit this) When checking that ‘it’ has the inferred type it :: forall t. Num [t] => [t] *February27> :t f f :: Num a => a -> a *February27> f 7 12 *February27> f 12.5 17.5 *February27> f 'a' :12:1: No instance for (Num Char) arising from a use of ‘f’ In the expression: f 'a' In an equation for ‘it’: it = f 'a' *February27> :t id id :: t -> t *February27> id 5 5 *February27> id 12.5 12.5 *February27> (id f) 5 10 *February27> :t (id f) (id f) :: Num a => a -> a *February27> id f 5 10 *February27> id id id f 7 12 *February27> id id id f [] :20:1: Non type-variable argument in the constraint: Num [t] (Use FlexibleContexts to permit this) When checking that ‘it’ has the inferred type it :: forall t. Num [t] => [t] *February27> let ls x = [x] *February27> :t [4.5] [4.5] :: Fractional t => [t] *February27> :t ls ls :: t -> [t] *February27> ls 4 [4] *February27> :t map map :: (a -> b) -> [a] -> [b] *February27> let g x y = x + y *February27> :t g g :: Num a => a -> a -> a *February27> g 4 5 9 *February27> let h = g 4 *February27> :t h h :: Num a => a -> a *February27> h 5 9 *February27> :t map map :: (a -> b) -> [a] -> [b] *February27> f 5 10 *February27> map f [1,2,3] [6,7,8] *February27> :t map f map f :: Num b => [b] -> [b] *February27> let m a b c d = a *February27> :t m m :: t3 -> t -> t1 -> t2 -> t3 *February27> let m a b c = a *February27> :t m m :: t2 -> t -> t1 -> t2 *February27> :t map (g 3) map (g 3) :: Num b => [b] -> [b] *February27> :t map g map g :: Num a => [a] -> [a -> a] *February27> let j = map g [1,2,3] *February27> head [1,2,3] *February27> :t head head :: [t] -> t *February27> (head j) 41 42 *February27> let secnd (_:x:_) = x *February27> (secnd j) 41 43 *February27>