hnix-0.5.1: Haskell implementation of the Nix language

Safe HaskellNone
LanguageHaskell2010

Nix.Expr.Types.Annotated

Description

The source location annotated nix expression type and supporting types.

Synopsis

Documentation

data SrcSpan Source #

A location in a source file

Constructors

SrcSpan 

Instances

Eq SrcSpan Source # 

Methods

(==) :: SrcSpan -> SrcSpan -> Bool #

(/=) :: SrcSpan -> SrcSpan -> Bool #

Data SrcSpan Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcSpan -> c SrcSpan #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcSpan #

toConstr :: SrcSpan -> Constr #

dataTypeOf :: SrcSpan -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c SrcSpan) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcSpan) #

gmapT :: (forall b. Data b => b -> b) -> SrcSpan -> SrcSpan #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r #

gmapQ :: (forall d. Data d => d -> u) -> SrcSpan -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcSpan -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan #

Ord SrcSpan Source # 
Show SrcSpan Source # 
Generic SrcSpan Source # 

Associated Types

type Rep SrcSpan :: * -> * #

Methods

from :: SrcSpan -> Rep SrcSpan x #

to :: Rep SrcSpan x -> SrcSpan #

Semigroup SrcSpan Source # 
Hashable SrcSpan Source # 

Methods

hashWithSalt :: Int -> SrcSpan -> Int #

hash :: SrcSpan -> Int #

Hashable NExprLoc Source # 

Methods

hashWithSalt :: Int -> NExprLoc -> Int #

hash :: NExprLoc -> Int #

ToJSON SrcSpan Source # 
FromJSON SrcSpan Source # 
Binary SrcSpan Source # 

Methods

put :: SrcSpan -> Put #

get :: Get SrcSpan #

putList :: [SrcSpan] -> Put #

Binary NExprLoc Source # 

Methods

put :: NExprLoc -> Put #

get :: Get NExprLoc #

putList :: [NExprLoc] -> Put #

NFData SrcSpan Source # 

Methods

rnf :: SrcSpan -> () #

NFData NExprLoc Source # 

Methods

rnf :: NExprLoc -> () #

Serialise SrcSpan Source # 
Serialise NExprLoc Source # 
Binary r => Binary (NExprLocF r) Source # 

Methods

put :: NExprLocF r -> Put #

get :: Get (NExprLocF r) #

putList :: [NExprLocF r] -> Put #

Has (Context m v) SrcSpan Source # 
Serialise r => Serialise (Compose * * (Ann SrcSpan) NExprF r) Source # 
type Rep SrcSpan Source # 
type Rep SrcSpan = D1 * (MetaData "SrcSpan" "Nix.Expr.Types.Annotated" "hnix-0.5.1-1AEILKRXuiNL8eYeTMwPu7" False) (C1 * (MetaCons "SrcSpan" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "spanBegin") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * SourcePos)) (S1 * (MetaSel (Just Symbol "spanEnd") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * SourcePos))))

data Ann ann a Source #

A type constructor applied to a type along with an annotation

Intended to be used with Fix: type MyType = Fix (Compose (Ann Annotation) F)

Constructors

Ann 

Fields

Instances

Hashable NExprLoc Source # 

Methods

hashWithSalt :: Int -> NExprLoc -> Int #

hash :: NExprLoc -> Int #

ToJSON2 Ann Source # 

Methods

liftToJSON2 :: (a -> Value) -> ([a] -> Value) -> (b -> Value) -> ([b] -> Value) -> Ann a b -> Value #

liftToJSONList2 :: (a -> Value) -> ([a] -> Value) -> (b -> Value) -> ([b] -> Value) -> [Ann a b] -> Value #

liftToEncoding2 :: (a -> Encoding) -> ([a] -> Encoding) -> (b -> Encoding) -> ([b] -> Encoding) -> Ann a b -> Encoding #

liftToEncodingList2 :: (a -> Encoding) -> ([a] -> Encoding) -> (b -> Encoding) -> ([b] -> Encoding) -> [Ann a b] -> Encoding #

FromJSON2 Ann Source # 

Methods

liftParseJSON2 :: (Value -> Parser a) -> (Value -> Parser [a]) -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (Ann a b) #

liftParseJSONList2 :: (Value -> Parser a) -> (Value -> Parser [a]) -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [Ann a b] #

Eq2 Ann Source # 

Methods

liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> Ann a c -> Ann b d -> Bool #

Ord2 Ann Source # 

Methods

liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> Ann a c -> Ann b d -> Ordering #

Read2 Ann Source # 

Methods

liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Ann a b) #

liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Ann a b] #

liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Ann a b) #

liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Ann a b] #

Show2 Ann Source # 

Methods

liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> Ann a b -> ShowS #

liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [Ann a b] -> ShowS #

Binary NExprLoc Source # 

Methods

put :: NExprLoc -> Put #

get :: Get NExprLoc #

putList :: [NExprLoc] -> Put #

NFData NExprLoc Source # 

Methods

rnf :: NExprLoc -> () #

Serialise NExprLoc Source # 
Functor (Ann ann) Source # 

Methods

fmap :: (a -> b) -> Ann ann a -> Ann ann b #

(<$) :: a -> Ann ann b -> Ann ann a #

Foldable (Ann ann) Source # 

Methods

fold :: Monoid m => Ann ann m -> m #

foldMap :: Monoid m => (a -> m) -> Ann ann a -> m #

foldr :: (a -> b -> b) -> b -> Ann ann a -> b #

foldr' :: (a -> b -> b) -> b -> Ann ann a -> b #

foldl :: (b -> a -> b) -> b -> Ann ann a -> b #

foldl' :: (b -> a -> b) -> b -> Ann ann a -> b #

foldr1 :: (a -> a -> a) -> Ann ann a -> a #

foldl1 :: (a -> a -> a) -> Ann ann a -> a #

toList :: Ann ann a -> [a] #

null :: Ann ann a -> Bool #

length :: Ann ann a -> Int #

elem :: Eq a => a -> Ann ann a -> Bool #

maximum :: Ord a => Ann ann a -> a #

minimum :: Ord a => Ann ann a -> a #

sum :: Num a => Ann ann a -> a #

product :: Num a => Ann ann a -> a #

Traversable (Ann ann) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Ann ann a -> f (Ann ann b) #

sequenceA :: Applicative f => Ann ann (f a) -> f (Ann ann a) #

mapM :: Monad m => (a -> m b) -> Ann ann a -> m (Ann ann b) #

sequence :: Monad m => Ann ann (m a) -> m (Ann ann a) #

ToJSON ann => ToJSON1 (Ann ann) Source # 

Methods

liftToJSON :: (a -> Value) -> ([a] -> Value) -> Ann ann a -> Value #

liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Ann ann a] -> Value #

liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Ann ann a -> Encoding #

liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Ann ann a] -> Encoding #

FromJSON ann => FromJSON1 (Ann ann) Source # 

Methods

liftParseJSON :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Ann ann a) #

liftParseJSONList :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Ann ann a] #

Eq ann => Eq1 (Ann ann) Source # 

Methods

liftEq :: (a -> b -> Bool) -> Ann ann a -> Ann ann b -> Bool #

Ord ann => Ord1 (Ann ann) Source # 

Methods

liftCompare :: (a -> b -> Ordering) -> Ann ann a -> Ann ann b -> Ordering #

Read ann => Read1 (Ann ann) Source # 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Ann ann a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Ann ann a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Ann ann a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Ann ann a] #

Show ann => Show1 (Ann ann) Source # 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Ann ann a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Ann ann a] -> ShowS #

Binary r => Binary (NExprLocF r) Source # 

Methods

put :: NExprLocF r -> Put #

get :: Get (NExprLocF r) #

putList :: [NExprLocF r] -> Put #

NFData ann => NFData1 (Ann ann) Source # 

Methods

liftRnf :: (a -> ()) -> Ann ann a -> () #

Hashable ann => Hashable1 (Ann ann) Source # 

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> Ann ann a -> Int #

Generic1 * (Ann ann) Source # 

Associated Types

type Rep1 (Ann ann) (f :: Ann ann -> *) :: k -> * #

Methods

from1 :: f a -> Rep1 (Ann ann) f a #

to1 :: Rep1 (Ann ann) f a -> f a #

(Eq a, Eq ann) => Eq (Ann ann a) Source # 

Methods

(==) :: Ann ann a -> Ann ann a -> Bool #

(/=) :: Ann ann a -> Ann ann a -> Bool #

(Data a, Data ann) => Data (Ann ann a) Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ann ann a -> c (Ann ann a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Ann ann a) #

toConstr :: Ann ann a -> Constr #

dataTypeOf :: Ann ann a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Ann ann a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Ann ann a)) #

gmapT :: (forall b. Data b => b -> b) -> Ann ann a -> Ann ann a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ann ann a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ann ann a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Ann ann a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Ann ann a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ann ann a -> m (Ann ann a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ann ann a -> m (Ann ann a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ann ann a -> m (Ann ann a) #

(Ord a, Ord ann) => Ord (Ann ann a) Source # 

Methods

compare :: Ann ann a -> Ann ann a -> Ordering #

(<) :: Ann ann a -> Ann ann a -> Bool #

(<=) :: Ann ann a -> Ann ann a -> Bool #

(>) :: Ann ann a -> Ann ann a -> Bool #

(>=) :: Ann ann a -> Ann ann a -> Bool #

max :: Ann ann a -> Ann ann a -> Ann ann a #

min :: Ann ann a -> Ann ann a -> Ann ann a #

(Read a, Read ann) => Read (Ann ann a) Source # 

Methods

readsPrec :: Int -> ReadS (Ann ann a) #

readList :: ReadS [Ann ann a] #

readPrec :: ReadPrec (Ann ann a) #

readListPrec :: ReadPrec [Ann ann a] #

(Show a, Show ann) => Show (Ann ann a) Source # 

Methods

showsPrec :: Int -> Ann ann a -> ShowS #

show :: Ann ann a -> String #

showList :: [Ann ann a] -> ShowS #

Generic (Ann ann a) Source # 

Associated Types

type Rep (Ann ann a) :: * -> * #

Methods

from :: Ann ann a -> Rep (Ann ann a) x #

to :: Rep (Ann ann a) x -> Ann ann a #

(Hashable a, Hashable ann) => Hashable (Ann ann a) Source # 

Methods

hashWithSalt :: Int -> Ann ann a -> Int #

hash :: Ann ann a -> Int #

(Binary ann, Binary a) => Binary (Ann ann a) Source # 

Methods

put :: Ann ann a -> Put #

get :: Get (Ann ann a) #

putList :: [Ann ann a] -> Put #

(NFData a, NFData ann) => NFData (Ann ann a) Source # 

Methods

rnf :: Ann ann a -> () #

(Serialise ann, Serialise a) => Serialise (Ann ann a) Source # 

Methods

encode :: Ann ann a -> Encoding #

decode :: Decoder s (Ann ann a) #

encodeList :: [Ann ann a] -> Encoding #

decodeList :: Decoder s [Ann ann a] #

Serialise r => Serialise (Compose * * (Ann SrcSpan) NExprF r) Source # 
type Rep1 * (Ann ann) Source # 
type Rep1 * (Ann ann) = D1 * (MetaData "Ann" "Nix.Expr.Types.Annotated" "hnix-0.5.1-1AEILKRXuiNL8eYeTMwPu7" False) (C1 * (MetaCons "Ann" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "annotation") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * ann)) (S1 * (MetaSel (Just Symbol "annotated") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1)))
type Rep (Ann ann a) Source # 
type Rep (Ann ann a) = D1 * (MetaData "Ann" "Nix.Expr.Types.Annotated" "hnix-0.5.1-1AEILKRXuiNL8eYeTMwPu7" False) (C1 * (MetaCons "Ann" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "annotation") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * ann)) (S1 * (MetaSel (Just Symbol "annotated") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a))))

type AnnF ann f = Compose (Ann ann) f Source #

annToAnnF :: Ann ann (f (Fix (AnnF ann f))) -> Fix (AnnF ann f) Source #

type NExprLoc = Fix NExprLocF Source #

A nix expression with source location at each subexpression.

pattern AnnE :: forall ann (g :: * -> *). ann -> g (Fix (Compose (Ann ann) g)) -> Fix (Compose (Ann ann) g) Source #

stripAnnotation :: Functor f => Fix (AnnF ann f) -> Fix f Source #

stripAnn :: AnnF ann f r -> f r Source #

pattern NSym_ :: SrcSpan -> VarName -> NExprLocF r Source #

Pattern systems for matching on NExprLocF constructions.

pattern NStr_ :: SrcSpan -> NString r -> NExprLocF r Source #

pattern NList_ :: SrcSpan -> [r] -> NExprLocF r Source #

pattern NSet_ :: SrcSpan -> [Binding r] -> NExprLocF r Source #

pattern NRecSet_ :: SrcSpan -> [Binding r] -> NExprLocF r Source #

pattern NSelect_ :: SrcSpan -> r -> NAttrPath r -> Maybe r -> NExprLocF r Source #

pattern NHasAttr_ :: SrcSpan -> r -> NAttrPath r -> NExprLocF r Source #

pattern NAbs_ :: SrcSpan -> Params r -> r -> NExprLocF r Source #

pattern NLet_ :: SrcSpan -> [Binding r] -> r -> NExprLocF r Source #

pattern NIf_ :: SrcSpan -> r -> r -> r -> NExprLocF r Source #

pattern NWith_ :: SrcSpan -> r -> r -> NExprLocF r Source #

pattern NAssert_ :: SrcSpan -> r -> r -> NExprLocF r Source #

pattern NUnary_ :: SrcSpan -> NUnaryOp -> r -> NExprLocF r Source #

pattern NBinary_ :: SrcSpan -> NBinaryOp -> r -> r -> NExprLocF r Source #

data SourcePos :: * #

The data type SourcePos represents source positions. It contains the name of the source file, a line number, and a column number. Source line and column positions change intensively during parsing, so we need to make them strict to avoid memory leaks.

Constructors

SourcePos 

Fields

Instances

Eq SourcePos 
Data SourcePos 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SourcePos -> c SourcePos #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SourcePos #

toConstr :: SourcePos -> Constr #

dataTypeOf :: SourcePos -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c SourcePos) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SourcePos) #

gmapT :: (forall b. Data b => b -> b) -> SourcePos -> SourcePos #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r #

gmapQ :: (forall d. Data d => d -> u) -> SourcePos -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SourcePos -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos #

Ord SourcePos 
Read SourcePos 
Show SourcePos 
Generic SourcePos 

Associated Types

type Rep SourcePos :: * -> * #

NFData SourcePos 

Methods

rnf :: SourcePos -> () #

MonadThunk (NValue m) (NThunk m) m => ToValue SourcePos m (NValue m) Source # 

Methods

toValue :: SourcePos -> m (NValue m) Source #

Applicative m => ToNix (HashMap Text (NThunk m), HashMap Text SourcePos) m (NValue m) Source # 
Applicative m => ToNix (HashMap Text (NValueNF m), HashMap Text SourcePos) m (NValueNF m) Source # 
Convertible e m => FromNix (HashMap Text (NThunk m), HashMap Text SourcePos) m (NValue m) Source # 
Convertible e m => FromNix (HashMap Text (NValueNF m), HashMap Text SourcePos) m (NValueNF m) Source # 
Applicative m => ToValue (HashMap Text (NThunk m), HashMap Text SourcePos) m (NValue m) Source # 
Applicative m => ToValue (HashMap Text (NValueNF m), HashMap Text SourcePos) m (NValueNF m) Source # 
ToValue (AttrSet (SThunk m), AttrSet SourcePos) m (Symbolic m) Source # 
Convertible e m => FromValue (HashMap Text (NThunk m), HashMap Text SourcePos) m (NValue m) Source # 
Convertible e m => FromValue (HashMap Text (NValueNF m), HashMap Text SourcePos) m (NValueNF m) Source # 
FromValue (AttrSet (SThunk m), AttrSet SourcePos) m (Symbolic m) Source # 
type Rep SourcePos 
type Rep SourcePos = D1 * (MetaData "SourcePos" "Text.Megaparsec.Pos" "megaparsec-6.5.0-1j1Pq3EX3Lmy68pRo470X" False) (C1 * (MetaCons "SourcePos" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "sourceName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * FilePath)) ((:*:) * (S1 * (MetaSel (Just Symbol "sourceLine") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * Pos)) (S1 * (MetaSel (Just Symbol "sourceColumn") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * Pos)))))

unPos :: Pos -> Int #

Extract Int from Pos.

Since: 6.0.0

mkPos :: Int -> Pos #

Construction of Pos from Int. The function throws InvalidPosException when given a non-positive argument.

Since: 6.0.0