*Main> myEq Blue True :7:11: error: • Couldn't match expected type ‘Color’ with actual type ‘Bool’ • In the second argument of ‘myEq’, namely ‘True’ In the expression: myEq Blue True In an equation for ‘it’: it = myEq Blue True *Main> myEq Blue Red False *Main> myEq [Blue, Blue] [Blue, Blue] True *Main> myEq [True] [] False *Main> myEq [1,2,3] [1,2,3] :11:1: error: • Ambiguous type variable ‘a0’ arising from a use of ‘myEq’ prevents the constraint ‘(MyEq a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. These potential instances exist: instance [safe] MyEq Color -- Defined at lec6.hs:53:10 instance [safe] MyEq a => MyEq (Tree a) -- Defined at lec6.hs:76:10 instance [safe] MyEq a => MyEq (Maybe a) -- Defined at lec6.hs:80:10 ...plus three others (use -fprint-potential-instances to see them all) • In the expression: myEq [1, 2, 3] [1, 2, 3] In an equation for ‘it’: it = myEq [1, 2, 3] [1, 2, 3] :11:7: error: • Ambiguous type variable ‘a0’ arising from the literal ‘1’ prevents the constraint ‘(Num a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. These potential instances exist: instance Num Integer -- Defined in ‘GHC.Num’ instance Num Double -- Defined in ‘GHC.Float’ instance Num Float -- Defined in ‘GHC.Float’ ...plus two others ...plus six instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: 1 In the first argument of ‘myEq’, namely ‘[1, 2, 3]’ In the expression: myEq [1, 2, 3] [1, 2, 3] *Main> :t [1,2,3] [1,2,3] :: Num a => [a] *Main> myEq [1,2,3] ([1,2,3] :: [Int]) True *Main> :t Nothing Nothing :: Maybe a *Main> :t Just Just :: a -> Maybe a Prelude> :t (==) (==) :: Eq a => a -> a -> Bool *Main> Empty == Empty True *Main> :t show show :: Show a => a -> String *Main> show Empty "Empty" *Main> show (Node 1 Empty Empty) "Node 1 Empty Empty" *Main> show (Node Blue Empty Empty) :25:1: error: • No instance for (Show Color) arising from a use of ‘show’ • In the expression: show (Node Blue Empty Empty) In an equation for ‘it’: it = show (Node Blue Empty Empty) *Main> show (Node Blue Empty Empty) "Node Blue Empty Empty" *Main> :t read read :: Read a => String -> a *Main> :t show show :: Show a => a -> String *Main> show Red "Red" *Main> read "Red" *** Exception: Prelude.read: no parse *Main> :r Ok, one module loaded. *Main> read "Blue" *** Exception: Prelude.read: no parse *Main> (read "Blue" :: Color) Blue *Main> :t read read :: Read a => String -> a *Main> greater False False False *Main> geq False False True *Main> geq False False False *Main> :t (+) (+) :: Num a => a -> a -> a *Main> square 1.2 :45:1: error: • Ambiguous type variable ‘a0’ arising from a use of ‘print’ prevents the constraint ‘(Show a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. These potential instances exist: instance (Show a, Show b) => Show (Either a b) -- Defined in ‘Data.Either’ instance Show Ordering -- Defined in ‘GHC.Show’ instance Show Integer -- Defined in ‘GHC.Show’ ...plus 25 others ...plus 53 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In a stmt of an interactive GHCi command: print it *Main> square (1.2 :: Float) 1.44 *Main> square (2 :: Int) 4 *Main> square (2 :: Integer) :48:1: error: • No instance for (MyNum Integer) arising from a use of ‘square’ • In the expression: square (2 :: Integer) In an equation for ‘it’: it = square (2 :: Integer)