[Haskell-beginners] Functions as Applicatives
Imants Cekusins
imantc at gmail.com
Mon Aug 22 18:13:30 UTC 2016
.. actually, I got fg wrong. Caught it by changing g to (/ ):
f::Fractional f => f -> f -> f
f = (+)
g::Fractional g => g -> g
g a = a / 2
h::Fractional h => h -> h
h = (* 10)
fg::Fractional a => a -> a -> a
fg = f <$> g
{- fg a b = (a / 2) + b
fg a = \b -> (a / 2) + b
-}
fgh::Fractional a => a -> a
fgh = fg <*> h
{- fgh a = fg a (a * 10)
fgh = \a -> fg a (a * 10)
-}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160822/25e8cf31/attachment.html>
More information about the Beginners
mailing list