language-ninja-0.1.0: A library for dealing with the Ninja build language.

CopyrightCopyright 2011-2017 Neil Mitchell
LicenseBSD3
Maintaineropensource@awakesecurity.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Language.Ninja.AST.Env

Description

This module contains a type representing a Ninja-style environment along with any supporting or related types.

Since: 0.1.0

Synopsis

Documentation

data Env k v Source #

A Ninja-style environment, basically a nonempty list of hash tables.

Since: 0.1.0

Instances

(Monad m, EnvConstraint (Serial m) k v) => Serial m (Env k v) Source #

Uses the underlying Maps instance.

Since: 0.1.0

Methods

series :: Series m (Env k v) #

(Monad m, EnvConstraint (CoSerial m) k v) => CoSerial m (Env k v) Source #

Uses the underlying Maps instance.

Since: 0.1.0

Methods

coseries :: Series m b -> Series m (Env k v -> b) #

(Eq v, Eq k) => Eq (Env k v) Source # 

Methods

(==) :: Env k v -> Env k v -> Bool #

(/=) :: Env k v -> Env k v -> Bool #

(Show v, Show k) => Show (Env k v) Source # 

Methods

showsPrec :: Int -> Env k v -> ShowS #

show :: Env k v -> String #

showList :: [Env k v] -> ShowS #

Generic (Env k v) Source # 

Associated Types

type Rep (Env k v) :: * -> * #

Methods

from :: Env k v -> Rep (Env k v) x #

to :: Rep (Env k v) x -> Env k v #

(Key k, Arbitrary k, Arbitrary v) => Arbitrary (Env k v) Source #

Reasonable Arbitrary instance for Env.

Since: 0.1.0

Methods

arbitrary :: Gen (Env k v) #

shrink :: Env k v -> [Env k v] #

(Hashable k, Hashable v) => Hashable (Env k v) Source #

Default Hashable instance via Generic.

Since: 0.1.0

Methods

hashWithSalt :: Int -> Env k v -> Int #

hash :: Env k v -> Int #

(ToJSONKey k, ToJSON v) => ToJSON (Env k v) Source #

Converts to a (nonempty) array of JSON objects.

Since: 0.1.0

Methods

toJSON :: Env k v -> Value #

toEncoding :: Env k v -> Encoding #

toJSONList :: [Env k v] -> Value #

toEncodingList :: [Env k v] -> Encoding #

(Key k, FromJSONKey k, FromJSON v) => FromJSON (Env k v) Source #

Inverse of the ToJSON instance.

Since: 0.1.0

Methods

parseJSON :: Value -> Parser (Env k v) #

parseJSONList :: Value -> Parser [Env k v] #

(NFData k, NFData v) => NFData (Env k v) Source #

Default NFData instance via Generic.

Since: 0.1.0

Methods

rnf :: Env k v -> () #

type Rep (Env k v) Source # 
type Rep (Env k v) = D1 (MetaData "Env" "Language.Ninja.AST.Env" "language-ninja-0.1.0-CTXTL0Lugm4Llo91nN4SIr" True) (C1 (MetaCons "MkEnv" PrefixI True) (S1 (MetaSel (Just Symbol "_fromEnv") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maps k v))))

makeEnv :: Env k v Source #

Construct an empty environment.

Since: 0.1.0

fromEnv :: Iso' (Env k v) (Maps k v) Source #

An isomorphism between an Env and a nonempty list of HashMaps.

Since: 0.1.0

headEnv :: Env k v -> HashMap k v Source #

Get the first HashMap in the underlying nonempty list.

Since: 0.1.0

tailEnv :: Env k v -> Maybe (Env k v) Source #

If the remainder of the underlying nonempty list is nonempty, return the remainder after Env wrapping. Otherwise, return Nothing.

Since: 0.1.0

scopeEnv :: Env k v -> Env k v Source #

Push a new Env onto the stack.

Since: 0.1.0

addEnv :: Key k => k -> v -> Env k v -> Env k v Source #

Add the given key and value to the given Env.

Since: 0.1.0

askEnv :: Key k => Env k v -> k -> Maybe v Source #

Look up the given key in the given Env.

Since: 0.1.0

type EnvConstraint c k v = (Key k, c k, c v, c (Maps k v)) Source #

The set of constraints required for a given constraint to be automatically computed for an Env.

Since: 0.1.0

type Key k = (Eq k, Hashable k) Source #

A constraint alias for (Eq k, Hashable k).

Since: 0.1.0

type Maps k v = NonEmpty (HashMap k v) Source #

A NonEmpty list of HashMaps.

Since: 0.1.0