Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let a = Just (5+) -- Instead of mapping + to Just 5
- let b = (3+) <$> a -- I imported Control.Applicative even though most of these modules are deprecated
- let c = Just (3+) <*> a -- I expect this to be equivalent to b and :t b, :t c shows that they are the 'same'
- a <*> Just 1 -- returns 6 as I expected
- b <*> Just 1 -- and get 9 as in (3+) $ (5+) 1 or ((3+) . (5+)) 1
- b :: (Num (a -> a), Num a) => Maybe (a -> a)
- let Just val = b <*> Just 1
- :t val -- returns ((Num (t -> t), Num t) => t which tells me that val is an instance of Num but then again I am just a beginner so what do I know?
- let b = (3+) <$> Just (5+)
- Just (3 + (5+))
- b :: (Num (a -> a), Num a) => Maybe (a -> a)
- let b = ((3+).) <$> Just (5+)
Add Comment
Please, Sign In to add comment