alex-meta 0.3.0.7 → 0.3.0.8
raw patch · 3 files changed
+20/−3 lines, 3 filesdep ~template-haskellPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: template-haskell
API changes (from Hackage documentation)
Files
- alex-meta.cabal +2/−2
- src/NFA.hs +9/−1
- src/ParseMonad.hs +9/−0
alex-meta.cabal view
@@ -1,5 +1,5 @@ Name: alex-meta-Version: 0.3.0.7+Version: 0.3.0.8 Synopsis: Quasi-quoter for Alex lexers -- Description: License: BSD3@@ -23,7 +23,7 @@ -- Packages needed in order to build this package. Build-depends:- template-haskell >=2.5&&<2.10+ template-haskell >=2.5&&<2.11 , haskell-src-meta >=0.5.1.2&&<1.0 , base >= 4.2 && < 5 , array, containers
src/NFA.hs view
@@ -23,7 +23,8 @@ import qualified Map hiding ( Map ) import Util ( str, space ) -import Control.Monad ( forM_, zipWithM, zipWithM_, when )+import Control.Applicative( Applicative(..) )+import Control.Monad ( forM_, zipWithM, zipWithM_, when, ap ) import Data.Array ( Array, (!), array, listArray, assocs, bounds ) -- Each state of a nondeterministic automaton contains a list of `Accept'@@ -167,6 +168,13 @@ m >>= k = N $ \s n e -> case unN m s n e of (s', n', a) -> unN (k a) s' n' e++instance Functor NFAM where+ fmap f a = a >>= (return . f)++instance Applicative NFAM where+ (<*>) = ap+ pure = return runNFA :: Encoding -> NFAM () -> NFA runNFA e m = case unN m 0 Map.empty e of
src/ParseMonad.hs view
@@ -20,6 +20,8 @@ import qualified Map hiding ( Map ) import UTF8 import Data.Word (Word8)+import Control.Monad ( ap )+import Control.Applicative ( Applicative(..) ) -- ----------------------------------------------------------------------------- -- The input type --import Codec.Binary.UTF8.Light as UTF8@@ -98,6 +100,13 @@ where initial_state = PState{ smac_env=senv, rmac_env=renv, startcode = 0, input=(alexStartPos,'\n',[],str) }++instance Functor P where+ fmap f a = a >>= (return . f)++instance Applicative P where+ (<*>) = ap+ pure = return failP :: String -> P a failP str = P $ \PState{ input = (p,_,_,_) } -> Left (Just p,str)