Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Why doesn't this function signature typecheck?
- data MyEither a b = MyLeft a | MyRight b
- deriving (Read, Show)
- extractEither :: MyEither a b -> c
- extractEither (MyLeft p) = p
- Couldn't match type `a' with `c'
- `a' is a rigid type variable bound by
- the type signature for extractEither :: MyEither a b -> c
- at /Users/tongmuchenxuan/playground/test.hs:5:1
- `c' is a rigid type variable bound by
- the type signature for extractEither :: MyEither a b -> c
- at /Users/tongmuchenxuan/playground/test.hs:5:1
- In the expression: p
- In an equation for `extractEither': extractEither (MyLeft p) = p
- extractEither :: MyEither a a -> a
- extractEither (MyLeft p) = p
- extractEither (MyRight p) = p
- extractMyLeft :: MyEither a b -> Maybe a
- extractMyRight :: MyEither a b -> Maybe b
- extractEither :: (a -> c) -> (b -> c) -> MyEither a b -> c
- extractEither f g (MyLeft x) = f x
- extractEither f g (MyRight y) = g y
- extractEither :: MyEither a b -> c
- extractEither (MyLeft p) = p
- public Object blah(Foo whatever);
Advertisement
Add Comment
Please, Sign In to add comment