I'm new to Haskell and reading Haskell from first principles.
right now I'm on chapter 5. while solving its exercises, specifically 7,8 I could not understand why I'm not coming up with right answer
so here is the question
u can find questions and solutions here
If the type of kessel is (Ord a, Num b) => a -> b -> a, then the type of kessel 1 2 is:
- Integer
- Int
- a
- (Num a, Ord a) => a
- Ord a => a
- Num a => a
I think its answer is 5. Ord a => a
, bcs its one of its possible implementation which I have come up with is to completely ignore parameter b
like this
kessel ::(Ord a, Num b) => a -> b -> a
kessel a b = a
--if u have any other implementation Please share
since Its completely ignoring b
it should not effect the type of a
but still ghci show its type is
:t kessel 1 2
kessel 1 2 :: (Ord a, Num a) => a
What I'm missing ? same goes with Q:8