| Safe Haskell | None |
|---|
Control.Applicative.QQ.Idiom
Description
Idiom brackets. Vixey's idea.
- i :: QuasiQuoter
Documentation
Turns function application into <*>, and puts a pure on the beginning.
[i| subtract [1,2,3] [10,20,30] |] -> pure subtract <*> [1,2,3] <*> [10,20,30] -> [9,19,29,8,18,28,7,17,27]
Does not apply to nested applications:
getZipList [i| subtract (ZipList [1,2,3]) (ZipList [10,20,30]) |] -> getZipList (pure subtract <*> ZipList [1,2,3] <*> ZipList [10,20,30]) -> [9,18,27]
Will treat [i| x `op` y |] as [i| op x y |] as long as neither x nor y
are an infix expression. If they are, will likely complain that it doesn't
have fixity information (unless haskell-src-meta becomes clever enough to
resolve that itself).