10 Oct
2017
10 Oct
'17
4:56 p.m.
Hello cafe, I am trying to do the following: data Foo = Foo { a1 :: Int -> Int, a2 :: Int -> Char } data Bar = Bar { a1 :: Int -> Int } func :: a -> Maybe (Int -> Int) -- a is either Foo or Bar func (x::(Bar/Foo) = Just $ a1 x func _ = Nothing I'm not sure how to implement this. All I know that the types are matching so I think it could be possible. Thanks for your help -Yotam