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