
Den 2017-11-26 kl. 20:48, skrev Quentin Liu:
``` exercises.hs:33:13: Couldn't match expected type ‘[b0]’ with actual type ‘a’ ‘a’ is a rigid type variable bound by the type signature for myOrderFunc :: a -> a -> Ordering at exercises.hs:31:16 Relevant bindings include y :: a (bound at exercises.hs:32:15) x :: a (bound at exercises.hs:32:13) myOrderFunc :: a -> a -> Ordering (bound at exercises.hs:32:1) In the first argument of ‘myLen’, namely ‘x’ In the first argument of ‘(<)’, namely ‘myLen x’ Failed, modules loaded: none. ```
Your guess is correct. The problem is, Haskell does not consider `a` in `myOrderFunc` and `[b]` in `myLen` equivalent. `a` means you feed the function any type, while `[b]` means it must be a list of values of the same type. So changing `a` to `[a]` woud eliminate the error. Thanks a lot for the clarification.
// Patrik