applicative-quoters 0.1.0.2 → 0.1.0.3
raw patch · 2 files changed
+11/−16 lines, 2 filesdep ~haskell-src-metaPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: haskell-src-meta
API changes (from Hackage documentation)
Files
Control/Applicative/QQ/Idiom.hs view
@@ -4,7 +4,8 @@ module Control.Applicative.QQ.Idiom (i) where -import Control.Applicative+import Control.Applicative ((<*>), pure)+import Control.Monad ((<=<)) import Language.Haskell.Meta (parseExp) import Language.Haskell.TH.Lib import Language.Haskell.TH.Quote@@ -13,18 +14,12 @@ -- ghci> [$i| (,) "foo" "bar" |] -- [('f','b'),('f','a'),('f','r'),('o','b'),('o','a'),('o','r'),('o','b'),('o','a'),('o','r')] i :: QuasiQuoter-i = QuasiQuoter { quoteExp = applicateQ }--applicateQ :: String -> ExpQ-applicateQ s = case either fail unwindE (parseExp s) of- x:y:xs -> foldl- (\e e' -> [|$e <*> $e'|])- [|$(return x) <$> $(return y)|]- (fmap return xs)- _ -> fail "applicateQ fails."+i = QuasiQuoter { quoteExp = applicate <=< either fail return . parseExp } -unwindE :: Exp -> [Exp]-unwindE = go []- where go acc (e `AppE` e') = go (e':acc) e- go acc e = e:acc+applicate :: Exp -> ExpQ+applicate (AppE f x) =+ [| $(applicate f) <*> $(return x) |]+applicate (InfixE (Just left) op (Just right)) =+ [| pure $(return op) <*> $(return left) <*> $(return right) |]+applicate x = [| pure $(return x) |]
applicative-quoters.cabal view
@@ -1,7 +1,7 @@ Cabal-Version: >= 1.6 Name: applicative-quoters-Version: 0.1.0.2+Version: 0.1.0.3 Category: Language Synopsis: Quasiquoters for idiom brackets and an applicative do-notation @@ -26,7 +26,7 @@ Build-depends: base >= 4 && < 4.5,- haskell-src-meta >= 0.2 && < 0.5,+ haskell-src-meta >= 0.2 && < 0.6, template-haskell >= 2.4 && < 2.7 -- We disable the missing-fields warning because not only do quoteType