Skip to content

Instantly share code, notes, and snippets.

@jbpotonnier
Created February 29, 2012 11:02
Show Gist options
  • Save jbpotonnier/1940017 to your computer and use it in GitHub Desktop.
Save jbpotonnier/1940017 to your computer and use it in GitHub Desktop.
Try to undersdand Haskell arrows
import Control.Arrow
facture :: Double -> String
facture = (* tjm)
>>>
id &&& (* tva) &&& (* (1 + tva))
>>>
show *** show *** show
>>>
("Brut: " ++) *** ("TVA: " ++) *** ("Net: " ++)
>>>
\ (b, (t, n)) -> b ++ " " ++ t ++ " " ++ n
where
tjm = 100.0
tva = 0.196
main :: IO ()
main = putStrLn $ facture 17.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment