needle 0.1.0.0 → 0.1.0.1
raw patch · 3 files changed
+19/−14 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Arrow.Needle.Parse: Through :: NeedleArrow -> Text -> NeedleArrow
+ Control.Arrow.Needle.Parse: Through :: (Maybe NeedleArrow) -> Text -> NeedleArrow
Files
- Control/Arrow/Needle/Parse.hs +7/−9
- Control/Arrow/Needle/TH.hs +9/−3
- needle.cabal +3/−2
Control/Arrow/Needle/Parse.hs view
@@ -42,7 +42,7 @@ -- | The datatype representing a generic needle arrow. data NeedleArrow = Input Int Int- | Through NeedleArrow T.Text+ | Through (Maybe NeedleArrow) T.Text | Join [NeedleArrow] deriving (Show, Read, Eq) @@ -137,7 +137,7 @@ e <- lDownGet n return $ mfilter (== (Switch Up)) e left <- tryPath leftGet- let paths = rights $ left : ups ++ downs+ let paths = rights $ ups ++ [left] ++ downs mJoint = arrowJoin paths case mJoint of Nothing -> do@@ -168,13 +168,9 @@ down <- tryPath $ do e <- lDownGet 0 return $ mfilter (== (Switch Up)) e- let paths = rights $ [left,up,down]+ let paths = rights $ [up,left,down] mJoint = arrowJoin paths- case mJoint of- Nothing -> do- (n, _) <- G.getPosition- err $ "External arrow '" ++ T.unpack t ++ "' on line " ++ show (n + 1) ++ " has no arrow going into it"- Just joint -> success $ Through joint t+ success $ Through mJoint t Switch d -> do left <- tryPath leftGet continuing <- tryPath $ do@@ -182,7 +178,9 @@ Down -> lUpGet 0 Up -> lDownGet 0 return $ mfilter (== h) e- let paths = rights $ [left, continuing]+ let paths = rights $ case d of+ Down -> [continuing, left]+ Up -> [left, continuing] mJoint = arrowJoin paths case mJoint of Nothing -> do
Control/Arrow/Needle/TH.hs view
@@ -20,6 +20,8 @@ import Control.Arrow.Needle.Parse import Control.Arrow +import Data.Maybe+ import Control.Applicative import Language.Haskell.TH@@ -81,9 +83,13 @@ $ AppE (VarE $ mkName "arr") $ LamE [TupP $ Pre.map VarP iNames] (VarE (iName i)) - f (Through a t) = do+ f (Through ma t) = do let ea = either error id $ parseExp . T.unpack $ t- b <- f a+ b <- case ma of+ Nothing -> return + $ AppE (VarE $ mkName "arr") + $ LamE [TupP $ Pre.map VarP iNames] (ConE $ mkName "()")+ Just a -> f a return $ InfixE (Just b) (VarE $ mkName ">>>") (Just ea) f (Join as) = do@@ -105,5 +111,5 @@ inputs :: NeedleArrow -> [(Int, Int)] inputs (Input a b) = [(a,b)]-inputs (Through a _) = inputs a+inputs (Through ma _) = maybe [] inputs ma inputs (Join as) = as >>= inputs
needle.cabal view
@@ -1,9 +1,10 @@ name: needle-version: 0.1.0.0+version: 0.1.0.1 synopsis: ASCII-fied arrow notation description: Needle is a domain specific language for ASCII-fied arrow notation. See "Control.Arrow.Needle" for more information and an example. license: MIT license-file: LICENSE+homepage: http://scrambledeggsontoast.github.io/2014/09/28/needle-announce/ author: Josh Kirklin maintainer: Josh Kirklin <jjvk2@cam.ac.uk> copyright: (c) 2014 Josh Kirklin@@ -31,4 +32,4 @@ source-repository head type: git- location: git://github.com/ScrambledEggsOnToast/needle.git+ location: http://github.com/ScrambledEggsOnToast/needle.git