Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Synopsis
- decode :: ByteString -> Either String Sexp
- parseSexp :: FilePath -> ByteString -> Either String Sexp
- parseSexps :: FilePath -> ByteString -> Either String [Sexp]
- parseSexpWithPos :: Position -> ByteString -> Either String Sexp
- parseSexpsWithPos :: Position -> ByteString -> Either String [Sexp]
- encode :: Sexp -> ByteString
- format :: Sexp -> ByteString
- type Sexp = Fix (Compose (LocatedBy Position) SexpF)
- pattern Atom :: Atom -> Sexp
- pattern Number :: Scientific -> Sexp
- pattern Symbol :: Text -> Sexp
- pattern String :: Text -> Sexp
- pattern ParenList :: [Sexp] -> Sexp
- pattern BracketList :: [Sexp] -> Sexp
- pattern BraceList :: [Sexp] -> Sexp
- pattern Modified :: Prefix -> Sexp -> Sexp
- data SexpF e
- = AtomF !Atom
- | ParenListF [e]
- | BracketListF [e]
- | BraceListF [e]
- | ModifiedF !Prefix e
- data Atom
- = AtomNumber !Scientific
- | AtomString !Text
- | AtomSymbol !Text
- data Prefix
- data LocatedBy a e = !a :< e
- data Position = Position FilePath !Int !Int
- newtype Compose (f :: k -> Type) (g :: k1 -> k) (a :: k1) = Compose {
- getCompose :: f (g a)
- newtype Fix (f :: Type -> Type) = Fix {}
- dummyPos :: Position
- fromSimple :: Fix SexpF -> Fix (Compose (LocatedBy Position) SexpF)
- toSimple :: Fix (Compose (LocatedBy Position) SexpF) -> Fix SexpF
Parse and print
parseSexps :: FilePath -> ByteString -> Either String [Sexp] Source #
Parse multiple Sexp
from a string.
parseSexpWithPos :: Position -> ByteString -> Either String Sexp Source #
Parse a Sexp
from a string, starting from a given
position. Useful for embedding into other parsers.
parseSexpsWithPos :: Position -> ByteString -> Either String [Sexp] Source #
Parse multiple Sexp
from a string, starting from a given
position. Useful for embedding into other parsers.
Type
type Sexp = Fix (Compose (LocatedBy Position) SexpF) Source #
S-expression type annotated with positions. Useful for further parsing.
pattern Number :: Scientific -> Sexp Source #
pattern BracketList :: [Sexp] -> Sexp Source #
Internal types
S-expression functor
AtomF !Atom | |
ParenListF [e] | |
BracketListF [e] | |
BraceListF [e] | |
ModifiedF !Prefix e |
Instances
S-expression atom type
Instances
Eq Atom Source # | |
Ord Atom Source # | |
Show Atom Source # | |
Generic Atom Source # | |
NFData Atom Source # | |
Defined in Language.Sexp.Types | |
Pretty Atom Source # | |
Defined in Language.Sexp.Pretty | |
type Rep Atom Source # | |
Defined in Language.Sexp.Types type Rep Atom = D1 ('MetaData "Atom" "Language.Sexp.Types" "sexp-grammar-2.3.0-JCnumEn9wOUGbR0nPzOSB9" 'False) (C1 ('MetaCons "AtomNumber" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Scientific)) :+: (C1 ('MetaCons "AtomString" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "AtomSymbol" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Text)))) |
S-expression quotation type
Instances
Eq Prefix Source # | |
Ord Prefix Source # | |
Show Prefix Source # | |
Generic Prefix Source # | |
NFData Prefix Source # | |
Defined in Language.Sexp.Types | |
type Rep Prefix Source # | |
Defined in Language.Sexp.Types type Rep Prefix = D1 ('MetaData "Prefix" "Language.Sexp.Types" "sexp-grammar-2.3.0-JCnumEn9wOUGbR0nPzOSB9" 'False) ((C1 ('MetaCons "Quote" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Backtick" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Comma" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CommaAt" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Hash" 'PrefixI 'False) (U1 :: Type -> Type)))) |
Annotation functor for positions
!a :< e |
Instances
Position: file name, line number, column number
Instances
Eq Position Source # | |
Ord Position Source # | |
Defined in Language.Sexp.Types | |
Show Position Source # | |
Show Sexp Source # | |
Generic Position Source # | |
NFData Position Source # | |
Defined in Language.Sexp.Types | |
Pretty Position Source # | |
Defined in Language.Sexp.Types | |
NFData1 (Compose (LocatedBy Position) SexpF) Source # | |
type Rep Position Source # | |
Defined in Language.Sexp.Types type Rep Position = D1 ('MetaData "Position" "Language.Sexp.Types" "sexp-grammar-2.3.0-JCnumEn9wOUGbR0nPzOSB9" 'False) (C1 ('MetaCons "Position" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int)))) |
newtype Compose (f :: k -> Type) (g :: k1 -> k) (a :: k1) infixr 9 #
Right-to-left composition of functors. The composition of applicative functors is always applicative, but the composition of monads is not always a monad.
Compose infixr 9 | |
|
Instances
Show Sexp Source # | |
Functor f => Generic1 (Compose f g :: k -> Type) | Since: base-4.9.0.0 |
TestEquality f => TestEquality (Compose f g :: k2 -> Type) | The deduction (via generativity) that if Since: base-4.14.0.0 |
Defined in Data.Functor.Compose | |
(Functor f, Functor g) => Functor (Compose f g) | Since: base-4.9.0.0 |
(Applicative f, Applicative g) => Applicative (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose | |
(Foldable f, Foldable g) => Foldable (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose fold :: Monoid m => Compose f g m -> m # foldMap :: Monoid m => (a -> m) -> Compose f g a -> m # foldMap' :: Monoid m => (a -> m) -> Compose f g a -> m # foldr :: (a -> b -> b) -> b -> Compose f g a -> b # foldr' :: (a -> b -> b) -> b -> Compose f g a -> b # foldl :: (b -> a -> b) -> b -> Compose f g a -> b # foldl' :: (b -> a -> b) -> b -> Compose f g a -> b # foldr1 :: (a -> a -> a) -> Compose f g a -> a # foldl1 :: (a -> a -> a) -> Compose f g a -> a # toList :: Compose f g a -> [a] # null :: Compose f g a -> Bool # length :: Compose f g a -> Int # elem :: Eq a => a -> Compose f g a -> Bool # maximum :: Ord a => Compose f g a -> a # minimum :: Ord a => Compose f g a -> a # | |
(Traversable f, Traversable g) => Traversable (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose | |
(Eq1 f, Eq1 g) => Eq1 (Compose f g) | Since: base-4.9.0.0 |
(Ord1 f, Ord1 g) => Ord1 (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose | |
(Read1 f, Read1 g) => Read1 (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Compose f g a) # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Compose f g a] # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Compose f g a) # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Compose f g a] # | |
(Show1 f, Show1 g) => Show1 (Compose f g) | Since: base-4.9.0.0 |
(Alternative f, Applicative g) => Alternative (Compose f g) | Since: base-4.9.0.0 |
(NFData1 f, NFData1 g) => NFData1 (Compose f g) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
NFData1 (Compose (LocatedBy Position) SexpF) Source # | |
(Hashable1 f, Hashable1 g) => Hashable1 (Compose f g) | |
Defined in Data.Hashable.Class | |
(Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a) | Since: base-4.9.0.0 |
(Typeable a, Typeable f, Typeable g, Typeable k1, Typeable k2, Data (f (g a))) => Data (Compose f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> Compose f g a -> c (Compose f g a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Compose f g a) # toConstr :: Compose f g a -> Constr # dataTypeOf :: Compose f g a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Compose f g a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Compose f g a)) # gmapT :: (forall b. Data b => b -> b) -> Compose f g a -> Compose f g a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Compose f g a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Compose f g a -> r # gmapQ :: (forall d. Data d => d -> u) -> Compose f g a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Compose f g a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Compose f g a -> m (Compose f g a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Compose f g a -> m (Compose f g a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Compose f g a -> m (Compose f g a) # | |
(Ord1 f, Ord1 g, Ord a) => Ord (Compose f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose compare :: Compose f g a -> Compose f g a -> Ordering # (<) :: Compose f g a -> Compose f g a -> Bool # (<=) :: Compose f g a -> Compose f g a -> Bool # (>) :: Compose f g a -> Compose f g a -> Bool # (>=) :: Compose f g a -> Compose f g a -> Bool # | |
(Read1 f, Read1 g, Read a) => Read (Compose f g a) | Since: base-4.9.0.0 |
(Show1 f, Show1 g, Show a) => Show (Compose f g a) | Since: base-4.9.0.0 |
Generic (Compose f g a) | Since: base-4.9.0.0 |
(NFData1 f, NFData1 g, NFData a) => NFData (Compose f g a) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
(Hashable1 f, Hashable1 g, Hashable a) => Hashable (Compose f g a) | In general, |
Defined in Data.Hashable.Class | |
type Rep1 (Compose f g :: k -> Type) | |
Defined in Data.Functor.Compose | |
type Rep (Compose f g a) | |
Defined in Data.Functor.Compose |
newtype Fix (f :: Type -> Type) #
A fix-point type.
Instances
Show Sexp Source # | |
Show Sexp Source # | |
Eq1 f => Eq (Fix f) | |
(Typeable f, Data (f (Fix f))) => Data (Fix f) | |
Defined in Data.Fix gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Fix f -> c (Fix f) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Fix f) # dataTypeOf :: Fix f -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Fix f)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Fix f)) # gmapT :: (forall b. Data b => b -> b) -> Fix f -> Fix f # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fix f -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fix f -> r # gmapQ :: (forall d. Data d => d -> u) -> Fix f -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Fix f -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Fix f -> m (Fix f) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Fix f -> m (Fix f) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Fix f -> m (Fix f) # | |
Ord1 f => Ord (Fix f) | |
Read1 f => Read (Fix f) | |
Show1 f => Show (Fix f) | |
Generic (Fix f) | |
NFData1 f => NFData (Fix f) | |
Hashable1 f => Hashable (Fix f) | |
Pretty (Fix SexpF) Source # | |
Functor f => Recursive (Fix f) | |
Defined in Data.Functor.Foldable project :: Fix f -> Base (Fix f) (Fix f) # cata :: (Base (Fix f) a -> a) -> Fix f -> a # para :: (Base (Fix f) (Fix f, a) -> a) -> Fix f -> a # gpara :: (Corecursive (Fix f), Comonad w) => (forall b. Base (Fix f) (w b) -> w (Base (Fix f) b)) -> (Base (Fix f) (EnvT (Fix f) w a) -> a) -> Fix f -> a # prepro :: Corecursive (Fix f) => (forall b. Base (Fix f) b -> Base (Fix f) b) -> (Base (Fix f) a -> a) -> Fix f -> a # gprepro :: (Corecursive (Fix f), Comonad w) => (forall b. Base (Fix f) (w b) -> w (Base (Fix f) b)) -> (forall c. Base (Fix f) c -> Base (Fix f) c) -> (Base (Fix f) (w a) -> a) -> Fix f -> a # | |
Functor f => Corecursive (Fix f) | |
Defined in Data.Functor.Foldable embed :: Base (Fix f) (Fix f) -> Fix f # ana :: (a -> Base (Fix f) a) -> a -> Fix f # apo :: (a -> Base (Fix f) (Either (Fix f) a)) -> a -> Fix f # postpro :: Recursive (Fix f) => (forall b. Base (Fix f) b -> Base (Fix f) b) -> (a -> Base (Fix f) a) -> a -> Fix f # gpostpro :: (Recursive (Fix f), Monad m) => (forall b. m (Base (Fix f) b) -> Base (Fix f) (m b)) -> (forall c. Base (Fix f) c -> Base (Fix f) c) -> (a -> Base (Fix f) (m a)) -> a -> Fix f # | |
type Rep (Fix f) | |
type Base (Fix f) | |
Defined in Data.Functor.Foldable |