You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.3 KiB
1.3 KiB
Chapter Excercises
Multiple choice
- (c)
- (a)
- (b)
- (c)
Determine the type
Num a => aNum a => (a, [Char])(Integer, [Char])BoolIntBoolNum a => aNum a => a -> aFractional a => a[Char]
Does it compile?
- The definition of
wahootries to apply aNumto anotherNumwhich does not work. Either changebigNumto take an argument (bigNum x = (^) 5 $ x ; wahoo = bigNum $ 10) or fixwahoo, e.g.wahoo = bigNum2.Nothing wrong here. ctries to apply5tob = 5which does not work. It's also expected to take an argument in the definition ofd = c 200. A fix could thus be:c = a 10.cis not defined for the definition ofb.
Type variable or specific type constructor?
- /
zedis fully polymorphic,ZedandBlahare concrete.ais fully polymorphic,bis constrained andCis concrete.fandgare fully polymorphic andCis concrete.
Write a type signature
functionH :: [a] -> afunctionC :: (Ord a) => a -> a -> BoolfunctionS :: (a, b) -> b
Given a type, write the function
see src/defineFunc.hs
Fix it
- see src/sing.hs
- see src/sing.hs
- see src/arith3broken.hs
Type-Kwon-Do
see src/typekwondo.hs