purenix-1.1: Nix backend for PureScript. Transpile PureScript code to Nix.
Safe HaskellSafe-Inferred
LanguageHaskell2010

PureNix.Expr

Description

Nix expression types and auxiliary functions. Since Expr is actually a fixpoint over the ExprF base functor, this module also exposes auxiliary functions that serve as constructors.

Synopsis

Documentation

newtype Expr Source #

The fixpoint over ExprF, see haddocks there for more information.

Constructors

Expr 

Fields

Instances

Instances details
Show Expr Source # 
Instance details

Defined in PureNix.Expr

Methods

showsPrec :: Int -> Expr -> ShowS #

show :: Expr -> String #

showList :: [Expr] -> ShowS #

data ExprF f Source #

Base functor for a Nix expression. We don't aim to be able to represent every valid Nix expression, just the ones that are relevant for PureNix.

ExprF is the base functor for the Expr fixpoint. This allows us to easily annotate and consume it during pretty-printing.

Note that ExprF, unlike Key and ExprF, is a raw representation of the intended string, completely unquoted and unescaped. That means that it might consist of, for example, a single '"'. It is the job of the printer to figure out how to correctly escape those.

Constructors

Var Var 
Lam Var f 
App f f 
Attrs [Var] [(f, [Key])] [(Key, f)] 
Cond f f f 
List [f] 
Bin Op f f 
Not f 
Sel f Key 
Let (NonEmpty (Var, f)) f 
Int Integer 
Double Double 
String Text 
Path Text 

Instances

Instances details
Foldable ExprF Source # 
Instance details

Defined in PureNix.Expr

Methods

fold :: Monoid m => ExprF m -> m #

foldMap :: Monoid m => (a -> m) -> ExprF a -> m #

foldMap' :: Monoid m => (a -> m) -> ExprF a -> m #

foldr :: (a -> b -> b) -> b -> ExprF a -> b #

foldr' :: (a -> b -> b) -> b -> ExprF a -> b #

foldl :: (b -> a -> b) -> b -> ExprF a -> b #

foldl' :: (b -> a -> b) -> b -> ExprF a -> b #

foldr1 :: (a -> a -> a) -> ExprF a -> a #

foldl1 :: (a -> a -> a) -> ExprF a -> a #

toList :: ExprF a -> [a] #

null :: ExprF a -> Bool #

length :: ExprF a -> Int #

elem :: Eq a => a -> ExprF a -> Bool #

maximum :: Ord a => ExprF a -> a #

minimum :: Ord a => ExprF a -> a #

sum :: Num a => ExprF a -> a #

product :: Num a => ExprF a -> a #

Traversable ExprF Source # 
Instance details

Defined in PureNix.Expr

Methods

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

sequenceA :: Applicative f => ExprF (f a) -> f (ExprF a) #

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

sequence :: Monad m => ExprF (m a) -> m (ExprF a) #

Functor ExprF Source # 
Instance details

Defined in PureNix.Expr

Methods

fmap :: (a -> b) -> ExprF a -> ExprF b #

(<$) :: a -> ExprF b -> ExprF a #

Show f => Show (ExprF f) Source # 
Instance details

Defined in PureNix.Expr

Methods

showsPrec :: Int -> ExprF f -> ShowS #

show :: ExprF f -> String #

showList :: [ExprF f] -> ShowS #

data Op Source #

Constructors

Update 
Equals 
And 

Instances

Instances details
Show Op Source # 
Instance details

Defined in PureNix.Expr

Methods

showsPrec :: Int -> Op -> ShowS #

show :: Op -> String #

showList :: [Op] -> ShowS #

Eq Op Source # 
Instance details

Defined in PureNix.Expr

Methods

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

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

foldExpr :: (ExprF r -> r) -> Expr -> r Source #

lam :: Var -> Expr -> Expr Source #

cond :: Expr -> Expr -> Expr -> Expr Source #

attrs :: [Var] -> [(Expr, [Key])] -> [(Key, Expr)] -> Expr Source #

sel :: Expr -> Key -> Expr Source #

let' :: [(Var, Expr)] -> Expr -> Expr Source #

bin :: Op -> Expr -> Expr -> Expr Source #

builtin :: Key -> Expr Source #

Convenience constructor for builtins. Takes a Key, and gives you builtins.key