{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Text.Parsec.Indent (
IndentT, IndentParserT, IndentParser, runIndent,
runIndentParserT, runIndentParser,
withBlock, withBlock', block,
indented, same, sameOrIndented, checkIndent,
topLevel, notTopLevel,
withPos,
indentBrackets, indentAngles, indentBraces, indentParens,
(<+/>), (<-/>), (<*/>), (<?/>), Optional(..)
) where
import Control.Monad (ap, liftM2)
import Control.Monad.Identity (Identity, runIdentity)
import Control.Monad.Reader (ReaderT, ask, local, runReaderT)
import Text.Parsec
import qualified Text.Parsec.Indent.Explicit as Explicit
import Text.Parsec.Indent.Internal
import Text.Parsec.Token
referenceIndentation :: Monad m => IndentParserT s u m Indentation
referenceIndentation :: forall (m :: * -> *) s u.
Monad m =>
IndentParserT s u m Indentation
referenceIndentation = ParsecT s u (IndentT m) Indentation
forall r (m :: * -> *). MonadReader r m => m r
ask
type IndentT m = ReaderT Indentation m
type IndentParserT s u m a = ParsecT s u (IndentT m) a
type IndentParser s u a = IndentParserT s u Identity a
withBlock
:: (Monad m, Stream s (IndentT m) z)
=> (a -> [b] -> c)
-> IndentParserT s u m a
-> IndentParserT s u m b
-> IndentParserT s u m c
withBlock :: forall (m :: * -> *) s z a b c u.
(Monad m, Stream s (IndentT m) z) =>
(a -> [b] -> c)
-> IndentParserT s u m a
-> IndentParserT s u m b
-> IndentParserT s u m c
withBlock a -> [b] -> c
f IndentParserT s u m a
a IndentParserT s u m b
p = IndentParserT s u m c -> IndentParserT s u m c
forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a -> IndentParserT s u m a
withPos (IndentParserT s u m c -> IndentParserT s u m c)
-> IndentParserT s u m c -> IndentParserT s u m c
forall a b. (a -> b) -> a -> b
$ do
a
r1 <- IndentParserT s u m a
a
[b]
r2 <- [b] -> ParsecT s u (IndentT m) [b] -> ParsecT s u (IndentT m) [b]
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
option [] (IndentParserT s u m ()
forall (m :: * -> *) s z u.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ()
indented IndentParserT s u m ()
-> ParsecT s u (IndentT m) [b] -> ParsecT s u (IndentT m) [b]
forall a b.
ParsecT s u (IndentT m) a
-> ParsecT s u (IndentT m) b -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IndentParserT s u m b -> ParsecT s u (IndentT m) [b]
forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a -> IndentParserT s u m [a]
block IndentParserT s u m b
p)
c -> IndentParserT s u m c
forall a. a -> ParsecT s u (IndentT m) a
forall (m :: * -> *) a. Monad m => a -> m a
return (a -> [b] -> c
f a
r1 [b]
r2)
withBlock'
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m a
-> IndentParserT s u m b
-> IndentParserT s u m [b]
withBlock' :: forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a
-> IndentParserT s u m b -> IndentParserT s u m [b]
withBlock' = (a -> [b] -> [b])
-> IndentParserT s u m a
-> IndentParserT s u m b
-> IndentParserT s u m [b]
forall (m :: * -> *) s z a b c u.
(Monad m, Stream s (IndentT m) z) =>
(a -> [b] -> c)
-> IndentParserT s u m a
-> IndentParserT s u m b
-> IndentParserT s u m c
withBlock (([b] -> a -> [b]) -> a -> [b] -> [b]
forall a b c. (a -> b -> c) -> b -> a -> c
flip [b] -> a -> [b]
forall a b. a -> b -> a
const)
indented
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m ()
indented :: forall (m :: * -> *) s z u.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ()
indented = IndentParserT s u m Indentation
forall (m :: * -> *) s u.
Monad m =>
IndentParserT s u m Indentation
referenceIndentation IndentParserT s u m Indentation
-> (Indentation -> ParsecT s u (IndentT m) ())
-> ParsecT s u (IndentT m) ()
forall a b.
ParsecT s u (IndentT m) a
-> (a -> ParsecT s u (IndentT m) b) -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Indentation -> ParsecT s u (IndentT m) ()
forall (m :: * -> *) s z u.
(Monad m, Stream s m z) =>
Indentation -> ParsecT s u m ()
Explicit.indented
sameOrIndented
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m ()
sameOrIndented :: forall (m :: * -> *) s z u.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ()
sameOrIndented = IndentParserT s u m Indentation
forall (m :: * -> *) s u.
Monad m =>
IndentParserT s u m Indentation
referenceIndentation IndentParserT s u m Indentation
-> (Indentation -> ParsecT s u (IndentT m) ())
-> ParsecT s u (IndentT m) ()
forall a b.
ParsecT s u (IndentT m) a
-> (a -> ParsecT s u (IndentT m) b) -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Indentation -> ParsecT s u (IndentT m) ()
forall (m :: * -> *) s z u.
(Monad m, Stream s m z) =>
Indentation -> ParsecT s u m ()
Explicit.sameOrIndented
same
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m ()
same :: forall (m :: * -> *) s z u.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ()
same = IndentParserT s u m Indentation
forall (m :: * -> *) s u.
Monad m =>
IndentParserT s u m Indentation
referenceIndentation IndentParserT s u m Indentation
-> (Indentation -> ParsecT s u (IndentT m) ())
-> ParsecT s u (IndentT m) ()
forall a b.
ParsecT s u (IndentT m) a
-> (a -> ParsecT s u (IndentT m) b) -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Indentation -> ParsecT s u (IndentT m) ()
forall (m :: * -> *) s z u.
(Monad m, Stream s m z) =>
Indentation -> ParsecT s u m ()
Explicit.same
block
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m a
-> IndentParserT s u m [a]
block :: forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a -> IndentParserT s u m [a]
block = ParsecT s u (IndentT m) a -> ParsecT s u (IndentT m) [a]
forall (m :: * -> *) s z u a.
(Monad m, Stream s m z) =>
ParsecT s u m a -> ParsecT s u m [a]
Explicit.block
withPos
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m a
-> IndentParserT s u m a
withPos :: forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a -> IndentParserT s u m a
withPos IndentParserT s u m a
x = do
Indentation
p <- ParsecT s u (IndentT m) Indentation
forall (m :: * -> *) s u. Monad m => ParsecT s u m Indentation
Explicit.indentation
(Indentation -> Indentation)
-> IndentParserT s u m a -> IndentParserT s u m a
forall a.
(Indentation -> Indentation)
-> ParsecT s u (IndentT m) a -> ParsecT s u (IndentT m) a
forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local (Indentation -> Indentation -> Indentation
forall a b. a -> b -> a
const Indentation
p) IndentParserT s u m a
x
checkIndent
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m ()
checkIndent :: forall (m :: * -> *) s z u.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ()
checkIndent = IndentParserT s u m Indentation
forall (m :: * -> *) s u.
Monad m =>
IndentParserT s u m Indentation
referenceIndentation IndentParserT s u m Indentation
-> (Indentation -> ParsecT s u (IndentT m) ())
-> ParsecT s u (IndentT m) ()
forall a b.
ParsecT s u (IndentT m) a
-> (a -> ParsecT s u (IndentT m) b) -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Indentation -> ParsecT s u (IndentT m) ()
forall (m :: * -> *) s z u.
(Monad m, Stream s m z) =>
Indentation -> ParsecT s u m ()
Explicit.checkIndent
topLevel
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m ()
topLevel :: forall (m :: * -> *) s z u.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ()
topLevel = ParsecT s u (IndentT m) ()
forall (m :: * -> *) s z u.
(Monad m, Stream s m z) =>
ParsecT s u m ()
Explicit.topLevel
notTopLevel
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m ()
notTopLevel :: forall (m :: * -> *) s z u.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ()
notTopLevel = ParsecT s u (IndentT m) ()
forall (m :: * -> *) s z u.
(Monad m, Stream s m z) =>
ParsecT s u m ()
Explicit.notTopLevel
runIndentT :: Monad m => IndentT m a -> m a
runIndentT :: forall (m :: * -> *) a. Monad m => IndentT m a -> m a
runIndentT IndentT m a
i = IndentT m a -> Indentation -> m a
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT IndentT m a
i (Int -> Int -> Indentation
Indentation Int
1 Int
1)
runIndent :: IndentT Identity a -> a
runIndent :: forall a. IndentT Identity a -> a
runIndent = Identity a -> a
forall a. Identity a -> a
runIdentity (Identity a -> a)
-> (IndentT Identity a -> Identity a) -> IndentT Identity a -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IndentT Identity a -> Identity a
forall (m :: * -> *) a. Monad m => IndentT m a -> m a
runIndentT
runIndentParserT
:: (Monad m, Stream s (IndentT m) t)
=> IndentParserT s u m a
-> u
-> SourceName
-> s
-> m (Either ParseError a)
runIndentParserT :: forall (m :: * -> *) s t u a.
(Monad m, Stream s (IndentT m) t) =>
IndentParserT s u m a
-> u -> SourceName -> s -> m (Either ParseError a)
runIndentParserT IndentParserT s u m a
parser u
u SourceName
source s
txt =
IndentT m (Either ParseError a) -> m (Either ParseError a)
forall (m :: * -> *) a. Monad m => IndentT m a -> m a
runIndentT (IndentParserT s u m a
-> u -> SourceName -> s -> IndentT m (Either ParseError a)
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> u -> SourceName -> s -> m (Either ParseError a)
runParserT IndentParserT s u m a
parser u
u SourceName
source s
txt)
runIndentParser
:: Stream s (IndentT Identity) t
=> IndentParser s u a
-> u
-> SourceName
-> s
-> Either ParseError a
runIndentParser :: forall s t u a.
Stream s (IndentT Identity) t =>
IndentParser s u a -> u -> SourceName -> s -> Either ParseError a
runIndentParser IndentParser s u a
parser u
u SourceName
source s
txt =
Identity (Either ParseError a) -> Either ParseError a
forall a. Identity a -> a
runIdentity (IndentParser s u a
-> u -> SourceName -> s -> Identity (Either ParseError a)
forall (m :: * -> *) s t u a.
(Monad m, Stream s (IndentT m) t) =>
IndentParserT s u m a
-> u -> SourceName -> s -> m (Either ParseError a)
runIndentParserT IndentParser s u a
parser u
u SourceName
source s
txt)
(<+/>)
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m (a -> b)
-> IndentParserT s u m a
-> IndentParserT s u m b
IndentParserT s u m (a -> b)
a <+/> :: forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m (a -> b)
-> IndentParserT s u m a -> IndentParserT s u m b
<+/> IndentParserT s u m a
b = IndentParserT s u m (a -> b)
-> IndentParserT s u m a -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
ap IndentParserT s u m (a -> b)
a (IndentParserT s u m ()
forall (m :: * -> *) s z u.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ()
sameOrIndented IndentParserT s u m ()
-> IndentParserT s u m a -> IndentParserT s u m a
forall a b.
ParsecT s u (IndentT m) a
-> ParsecT s u (IndentT m) b -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IndentParserT s u m a
b)
(<-/>)
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m a
-> IndentParserT s u m b
-> IndentParserT s u m a
IndentParserT s u m a
a <-/> :: forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a
-> IndentParserT s u m b -> IndentParserT s u m a
<-/> IndentParserT s u m b
b = (a -> b -> a)
-> IndentParserT s u m a
-> IndentParserT s u m b
-> IndentParserT s u m a
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 a -> b -> a
forall a b. a -> b -> a
const IndentParserT s u m a
a (IndentParserT s u m ()
forall (m :: * -> *) s z u.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ()
sameOrIndented IndentParserT s u m ()
-> IndentParserT s u m b -> IndentParserT s u m b
forall a b.
ParsecT s u (IndentT m) a
-> ParsecT s u (IndentT m) b -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IndentParserT s u m b
b)
(<*/>)
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m ([a] -> b)
-> IndentParserT s u m a
-> IndentParserT s u m b
IndentParserT s u m ([a] -> b)
a <*/> :: forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ([a] -> b)
-> IndentParserT s u m a -> IndentParserT s u m b
<*/> IndentParserT s u m a
b = IndentParserT s u m ([a] -> b)
-> ParsecT s u (IndentT m) [a] -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
ap IndentParserT s u m ([a] -> b)
a (IndentParserT s u m a -> ParsecT s u (IndentT m) [a]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many (IndentParserT s u m ()
forall (m :: * -> *) s z u.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ()
sameOrIndented IndentParserT s u m ()
-> IndentParserT s u m a -> IndentParserT s u m a
forall a b.
ParsecT s u (IndentT m) a
-> ParsecT s u (IndentT m) b -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IndentParserT s u m a
b))
data Optional s u m a = Opt a (IndentParserT s u m a)
(<?/>)
:: (Monad m, Stream s (IndentT m) z)
=> IndentParserT s u m (a -> b)
-> (Optional s u m a)
-> IndentParserT s u m b
<?/> :: forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m (a -> b)
-> Optional s u m a -> IndentParserT s u m b
(<?/>) IndentParserT s u m (a -> b)
a (Opt a
b IndentParserT s u m a
c) = IndentParserT s u m (a -> b)
-> IndentParserT s u m a -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
ap IndentParserT s u m (a -> b)
a (a -> IndentParserT s u m a -> IndentParserT s u m a
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
option a
b (IndentParserT s u m ()
forall (m :: * -> *) s z u.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m ()
sameOrIndented IndentParserT s u m ()
-> IndentParserT s u m a -> IndentParserT s u m a
forall a b.
ParsecT s u (IndentT m) a
-> ParsecT s u (IndentT m) b -> ParsecT s u (IndentT m) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IndentParserT s u m a
c))
indentBrackets
:: (Monad m, Stream s (IndentT m) z)
=> GenTokenParser s u (IndentT m)
-> IndentParserT s u m a
-> IndentParserT s u m a
indentBrackets :: forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
GenTokenParser s u (IndentT m)
-> IndentParserT s u m a -> IndentParserT s u m a
indentBrackets GenTokenParser s u (IndentT m)
lexer IndentParserT s u m a
p = IndentParserT s u m a -> IndentParserT s u m a
forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a -> IndentParserT s u m a
withPos (IndentParserT s u m a -> IndentParserT s u m a)
-> IndentParserT s u m a -> IndentParserT s u m a
forall a b. (a -> b) -> a -> b
$ (a -> a) -> ParsecT s u (IndentT m) (a -> a)
forall a. a -> ParsecT s u (IndentT m) a
forall (m :: * -> *) a. Monad m => a -> m a
return a -> a
forall a. a -> a
id ParsecT s u (IndentT m) (a -> a)
-> IndentParserT s u m SourceName
-> ParsecT s u (IndentT m) (a -> a)
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a
-> IndentParserT s u m b -> IndentParserT s u m a
<-/> GenTokenParser s u (IndentT m)
-> SourceName -> IndentParserT s u m SourceName
forall s u (m :: * -> *).
GenTokenParser s u m -> SourceName -> ParsecT s u m SourceName
symbol GenTokenParser s u (IndentT m)
lexer SourceName
"[" ParsecT s u (IndentT m) (a -> a)
-> IndentParserT s u m a -> IndentParserT s u m a
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m (a -> b)
-> IndentParserT s u m a -> IndentParserT s u m b
<+/> IndentParserT s u m a
p IndentParserT s u m a
-> IndentParserT s u m SourceName -> IndentParserT s u m a
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a
-> IndentParserT s u m b -> IndentParserT s u m a
<-/> GenTokenParser s u (IndentT m)
-> SourceName -> IndentParserT s u m SourceName
forall s u (m :: * -> *).
GenTokenParser s u m -> SourceName -> ParsecT s u m SourceName
symbol GenTokenParser s u (IndentT m)
lexer SourceName
"]"
indentAngles
:: (Monad m, Stream s (IndentT m) z)
=> GenTokenParser s u (IndentT m)
-> IndentParserT s u m a
-> IndentParserT s u m a
indentAngles :: forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
GenTokenParser s u (IndentT m)
-> IndentParserT s u m a -> IndentParserT s u m a
indentAngles GenTokenParser s u (IndentT m)
lexer IndentParserT s u m a
p = IndentParserT s u m a -> IndentParserT s u m a
forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a -> IndentParserT s u m a
withPos (IndentParserT s u m a -> IndentParserT s u m a)
-> IndentParserT s u m a -> IndentParserT s u m a
forall a b. (a -> b) -> a -> b
$ (a -> a) -> ParsecT s u (IndentT m) (a -> a)
forall a. a -> ParsecT s u (IndentT m) a
forall (m :: * -> *) a. Monad m => a -> m a
return a -> a
forall a. a -> a
id ParsecT s u (IndentT m) (a -> a)
-> IndentParserT s u m SourceName
-> ParsecT s u (IndentT m) (a -> a)
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a
-> IndentParserT s u m b -> IndentParserT s u m a
<-/> GenTokenParser s u (IndentT m)
-> SourceName -> IndentParserT s u m SourceName
forall s u (m :: * -> *).
GenTokenParser s u m -> SourceName -> ParsecT s u m SourceName
symbol GenTokenParser s u (IndentT m)
lexer SourceName
"<" ParsecT s u (IndentT m) (a -> a)
-> IndentParserT s u m a -> IndentParserT s u m a
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m (a -> b)
-> IndentParserT s u m a -> IndentParserT s u m b
<+/> IndentParserT s u m a
p IndentParserT s u m a
-> IndentParserT s u m SourceName -> IndentParserT s u m a
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a
-> IndentParserT s u m b -> IndentParserT s u m a
<-/> GenTokenParser s u (IndentT m)
-> SourceName -> IndentParserT s u m SourceName
forall s u (m :: * -> *).
GenTokenParser s u m -> SourceName -> ParsecT s u m SourceName
symbol GenTokenParser s u (IndentT m)
lexer SourceName
">"
indentBraces
:: (Monad m, Stream s (IndentT m) z)
=> GenTokenParser s u (IndentT m)
-> IndentParserT s u m a
-> IndentParserT s u m a
indentBraces :: forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
GenTokenParser s u (IndentT m)
-> IndentParserT s u m a -> IndentParserT s u m a
indentBraces GenTokenParser s u (IndentT m)
lexer IndentParserT s u m a
p = IndentParserT s u m a -> IndentParserT s u m a
forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a -> IndentParserT s u m a
withPos (IndentParserT s u m a -> IndentParserT s u m a)
-> IndentParserT s u m a -> IndentParserT s u m a
forall a b. (a -> b) -> a -> b
$ (a -> a) -> ParsecT s u (IndentT m) (a -> a)
forall a. a -> ParsecT s u (IndentT m) a
forall (m :: * -> *) a. Monad m => a -> m a
return a -> a
forall a. a -> a
id ParsecT s u (IndentT m) (a -> a)
-> IndentParserT s u m SourceName
-> ParsecT s u (IndentT m) (a -> a)
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a
-> IndentParserT s u m b -> IndentParserT s u m a
<-/> GenTokenParser s u (IndentT m)
-> SourceName -> IndentParserT s u m SourceName
forall s u (m :: * -> *).
GenTokenParser s u m -> SourceName -> ParsecT s u m SourceName
symbol GenTokenParser s u (IndentT m)
lexer SourceName
"{" ParsecT s u (IndentT m) (a -> a)
-> IndentParserT s u m a -> IndentParserT s u m a
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m (a -> b)
-> IndentParserT s u m a -> IndentParserT s u m b
<+/> IndentParserT s u m a
p IndentParserT s u m a
-> IndentParserT s u m SourceName -> IndentParserT s u m a
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a
-> IndentParserT s u m b -> IndentParserT s u m a
<-/> GenTokenParser s u (IndentT m)
-> SourceName -> IndentParserT s u m SourceName
forall s u (m :: * -> *).
GenTokenParser s u m -> SourceName -> ParsecT s u m SourceName
symbol GenTokenParser s u (IndentT m)
lexer SourceName
"}"
indentParens
:: (Monad m, Stream s (IndentT m) z)
=> GenTokenParser s u (IndentT m)
-> IndentParserT s u m a
-> IndentParserT s u m a
indentParens :: forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
GenTokenParser s u (IndentT m)
-> IndentParserT s u m a -> IndentParserT s u m a
indentParens GenTokenParser s u (IndentT m)
lexer IndentParserT s u m a
p = IndentParserT s u m a -> IndentParserT s u m a
forall (m :: * -> *) s z u a.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a -> IndentParserT s u m a
withPos (IndentParserT s u m a -> IndentParserT s u m a)
-> IndentParserT s u m a -> IndentParserT s u m a
forall a b. (a -> b) -> a -> b
$ (a -> a) -> ParsecT s u (IndentT m) (a -> a)
forall a. a -> ParsecT s u (IndentT m) a
forall (m :: * -> *) a. Monad m => a -> m a
return a -> a
forall a. a -> a
id ParsecT s u (IndentT m) (a -> a)
-> IndentParserT s u m SourceName
-> ParsecT s u (IndentT m) (a -> a)
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a
-> IndentParserT s u m b -> IndentParserT s u m a
<-/> GenTokenParser s u (IndentT m)
-> SourceName -> IndentParserT s u m SourceName
forall s u (m :: * -> *).
GenTokenParser s u m -> SourceName -> ParsecT s u m SourceName
symbol GenTokenParser s u (IndentT m)
lexer SourceName
"(" ParsecT s u (IndentT m) (a -> a)
-> IndentParserT s u m a -> IndentParserT s u m a
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m (a -> b)
-> IndentParserT s u m a -> IndentParserT s u m b
<+/> IndentParserT s u m a
p IndentParserT s u m a
-> IndentParserT s u m SourceName -> IndentParserT s u m a
forall (m :: * -> *) s z u a b.
(Monad m, Stream s (IndentT m) z) =>
IndentParserT s u m a
-> IndentParserT s u m b -> IndentParserT s u m a
<-/> GenTokenParser s u (IndentT m)
-> SourceName -> IndentParserT s u m SourceName
forall s u (m :: * -> *).
GenTokenParser s u m -> SourceName -> ParsecT s u m SourceName
symbol GenTokenParser s u (IndentT m)
lexer SourceName
")"