hnix-0.5.1: Haskell implementation of the Nix language

Safe HaskellNone
LanguageHaskell2010

Nix.Convert

Description

Although there are a lot of instances in this file, really it's just a combinatorial explosion of the following combinations:

  • Several Haskell types being converted to/from Nix wrappers
  • Several types of Nix wrappers
  • Whether to be shallow or deep while unwrapping

Documentation

class FromValue a m v where Source #

Minimal complete definition

fromValue, fromValueMay

Methods

fromValue :: v -> m a Source #

fromValueMay :: v -> m (Maybe a) Source #

Instances

Convertible e m => FromValue Bool m (NValue m) Source # 
Convertible e m => FromValue Bool m (NValueNF m) Source # 
Convertible e m => FromValue Float m (NValue m) Source # 
Convertible e m => FromValue Float m (NValueNF m) Source # 
Convertible e m => FromValue Int m (NValue m) Source # 
Convertible e m => FromValue Int m (NValueNF m) Source # 
Convertible e m => FromValue Integer m (NValue m) Source # 
Convertible e m => FromValue Integer m (NValueNF m) Source # 
Convertible e m => FromValue () m (NValue m) Source # 

Methods

fromValue :: NValue m -> m () Source #

fromValueMay :: NValue m -> m (Maybe ()) Source #

Convertible e m => FromValue () m (NValueNF m) Source # 

Methods

fromValue :: NValueNF m -> m () Source #

fromValueMay :: NValueNF m -> m (Maybe ()) Source #

(MonadThunk (NValue m) (NThunk m) m, FromValue a m (NValue m)) => FromValue a m (NThunk m) Source # 

Methods

fromValue :: NThunk m -> m a Source #

fromValueMay :: NThunk m -> m (Maybe a) Source #

(Monad m, FromValue a m v) => FromValue a m (m v) Source # 

Methods

fromValue :: m v -> m a Source #

fromValueMay :: m v -> m (Maybe a) Source #

Convertible e m => FromValue ByteString m (NValue m) Source # 
Convertible e m => FromValue ByteString m (NValueNF m) Source # 
(Convertible e m, MonadThunk (NValue m) (NThunk m) m, MonadEffects m) => FromValue Text m (NValue m) Source # 
(Convertible e m, MonadEffects m) => FromValue Text m (NValueNF m) Source # 
(Convertible e m, MonadEffects m) => FromValue Value m (NValueNF m) Source # 
(Convertible e m, MonadThunk (NValue m) (NThunk m) m) => FromValue Path m (NValue m) Source # 
Convertible e m => FromValue Path m (NValueNF m) Source # 
(Convertible e m, FromValue a m (NValueNF m), Show a) => FromValue [a] m (NValueNF m) Source # 

Methods

fromValue :: NValueNF m -> m [a] Source #

fromValueMay :: NValueNF m -> m (Maybe [a]) Source #

Convertible e m => FromValue [NThunk m] m (NValue m) Source # 

Methods

fromValue :: NValue m -> m [NThunk m] Source #

fromValueMay :: NValue m -> m (Maybe [NThunk m]) Source #

(Convertible e m, MonadThunk (NValue m) (NThunk m) m) => FromValue (NThunk m) m (NValue m) Source # 

Methods

fromValue :: NValue m -> m (NThunk m) Source #

fromValueMay :: NValue m -> m (Maybe (NThunk m)) Source #

(Convertible e m, MonadThunk (NValue m) (NThunk m) m, MonadEffects m) => FromValue (Text, DList Text) m (NValue m) Source # 
(Convertible e m, MonadEffects m) => FromValue (Text, DList Text) m (NValueNF m) Source # 
FromValue (Text, DList Text) 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 # 
Convertible e m => FromValue (HashMap Text (NThunk m)) m (NValue m) Source # 
Convertible e m => FromValue (HashMap Text (NValueNF m)) m (NValueNF m) Source # 

type Convertible e m = (Framed e m, MonadVar m, Typeable m) Source #

newtype Path Source #

Constructors

Path 

Fields

class ToValue a m v where Source #

Minimal complete definition

toValue

Methods

toValue :: a -> m v Source #

Instances

Applicative m => ToValue Bool m (NExprF r) Source # 

Methods

toValue :: Bool -> m (NExprF r) Source #

Applicative m => ToValue Bool m (NValue m) Source # 

Methods

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

Applicative m => ToValue Bool m (NValueNF m) Source # 

Methods

toValue :: Bool -> m (NValueNF m) Source #

ToValue Bool m (Symbolic m) Source # 

Methods

toValue :: Bool -> m (Symbolic m) Source #

Applicative m => ToValue Float m (NValue m) Source # 

Methods

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

Applicative m => ToValue Float m (NValueNF m) Source # 

Methods

toValue :: Float -> m (NValueNF m) Source #

Applicative m => ToValue Int m (NValue m) Source # 

Methods

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

Applicative m => ToValue Int m (NValueNF m) Source # 

Methods

toValue :: Int -> m (NValueNF m) Source #

Applicative m => ToValue Integer m (NValue m) Source # 

Methods

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

Applicative m => ToValue Integer m (NValueNF m) Source # 

Methods

toValue :: Integer -> m (NValueNF m) Source #

Applicative m => ToValue () m (NExprF r) Source # 

Methods

toValue :: () -> m (NExprF r) Source #

Applicative m => ToValue () m (NValue m) Source # 

Methods

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

Applicative m => ToValue () m (NValueNF m) Source # 

Methods

toValue :: () -> m (NValueNF m) Source #

(MonadThunk (NValue m) (NThunk m) m, ToValue a m (NValue m)) => ToValue a m (NThunk m) Source # 

Methods

toValue :: a -> m (NThunk m) Source #

Applicative m => ToValue ByteString m (NValue m) Source # 

Methods

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

Applicative m => ToValue ByteString m (NValueNF m) Source # 

Methods

toValue :: ByteString -> m (NValueNF m) Source #

Applicative m => ToValue Text m (NValue m) Source # 

Methods

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

Applicative m => ToValue Text m (NValueNF m) Source # 

Methods

toValue :: Text -> m (NValueNF m) Source #

(Convertible e m, MonadThunk (NValue m) (NThunk m) m) => ToValue Value m (NValue m) Source # 

Methods

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

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

Methods

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

Applicative m => ToValue Path m (NValue m) Source # 

Methods

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

Applicative m => ToValue Path m (NValueNF m) Source # 

Methods

toValue :: Path -> m (NValueNF m) Source #

(ToValue a m (NValueNF m), Applicative m) => ToValue [a] m (NValueNF m) Source # 

Methods

toValue :: [a] -> m (NValueNF m) Source #

Applicative m => ToValue [NThunk m] m (NValue m) Source # 

Methods

toValue :: [NThunk m] -> m (NValue m) Source #

ToValue [SThunk m] m (Symbolic m) Source # 

Methods

toValue :: [SThunk m] -> m (Symbolic m) Source #

Applicative m => ToValue (Text, DList Text) m (NValue m) Source # 

Methods

toValue :: (Text, DList Text) -> m (NValue m) Source #

Applicative m => ToValue (Text, DList Text) m (NValueNF m) Source # 

Methods

toValue :: (Text, DList Text) -> 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 # 
Applicative m => ToValue (HashMap Text (NThunk m)) m (NValue m) Source # 

Methods

toValue :: HashMap Text (NThunk m) -> m (NValue m) Source #

Applicative m => ToValue (HashMap Text (NValueNF m)) m (NValueNF m) Source # 

Methods

toValue :: HashMap Text (NValueNF m) -> m (NValueNF m) Source #

whileForcingThunk :: forall s e m r. (Framed e m, Exception s, Typeable m) => s -> m r -> m r Source #

class FromNix a m v where Source #

Methods

fromNix :: v -> m a Source #

fromNix :: FromValue a m v => v -> m a Source #

fromNixMay :: v -> m (Maybe a) Source #

fromNixMay :: FromValue a m v => v -> m (Maybe a) Source #

Instances

Convertible e m => FromNix Bool m (NValue m) Source # 

Methods

fromNix :: NValue m -> m Bool Source #

fromNixMay :: NValue m -> m (Maybe Bool) Source #

Convertible e m => FromNix Bool m (NValueNF m) Source # 
Convertible e m => FromNix Float m (NValue m) Source # 
Convertible e m => FromNix Float m (NValueNF m) Source # 
Convertible e m => FromNix Int m (NValue m) Source # 

Methods

fromNix :: NValue m -> m Int Source #

fromNixMay :: NValue m -> m (Maybe Int) Source #

Convertible e m => FromNix Int m (NValueNF m) Source # 
Convertible e m => FromNix Integer m (NValue m) Source # 
Convertible e m => FromNix Integer m (NValueNF m) Source # 
Convertible e m => FromNix () m (NValue m) Source # 

Methods

fromNix :: NValue m -> m () Source #

fromNixMay :: NValue m -> m (Maybe ()) Source #

Convertible e m => FromNix () m (NValueNF m) Source # 

Methods

fromNix :: NValueNF m -> m () Source #

fromNixMay :: NValueNF m -> m (Maybe ()) Source #

(MonadThunk (NValue m) (NThunk m) m, FromNix a m (NValue m)) => FromNix a m (NThunk m) Source # 

Methods

fromNix :: NThunk m -> m a Source #

fromNixMay :: NThunk m -> m (Maybe a) Source #

(Monad m, FromNix a m v) => FromNix a m (m v) Source # 

Methods

fromNix :: m v -> m a Source #

fromNixMay :: m v -> m (Maybe a) Source #

Convertible e m => FromNix ByteString m (NValue m) Source # 
Convertible e m => FromNix ByteString m (NValueNF m) Source # 
(Convertible e m, MonadEffects m, MonadThunk (NValue m) (NThunk m) m) => FromNix Text m (NValue m) Source # 

Methods

fromNix :: NValue m -> m Text Source #

fromNixMay :: NValue m -> m (Maybe Text) Source #

(Convertible e m, MonadEffects m) => FromNix Text m (NValueNF m) Source # 
(Convertible e m, MonadEffects m, MonadThunk (NValue m) (NThunk m) m) => FromNix Value m (NValue m) Source # 
(Convertible e m, MonadEffects m, MonadThunk (NValue m) (NThunk m) m) => FromNix Value m (NValueNF m) Source # 
(Convertible e m, MonadThunk (NValue m) (NThunk m) m) => FromNix Path m (NValue m) Source # 

Methods

fromNix :: NValue m -> m Path Source #

fromNixMay :: NValue m -> m (Maybe Path) Source #

Convertible e m => FromNix Path m (NValueNF m) Source # 
(Convertible e m, FromValue a m (NValueNF m), Show a) => FromNix [a] m (NValueNF m) Source # 

Methods

fromNix :: NValueNF m -> m [a] Source #

fromNixMay :: NValueNF m -> m (Maybe [a]) Source #

(Convertible e m, MonadThunk (NValue m) (NThunk m) m, FromNix a m (NValue m)) => FromNix [a] m (NValue m) Source # 

Methods

fromNix :: NValue m -> m [a] Source #

fromNixMay :: NValue m -> m (Maybe [a]) Source #

MonadThunk (NValue m) (NThunk m) m => FromNix (NThunk m) m (NValue m) Source # 

Methods

fromNix :: NValue m -> m (NThunk m) Source #

fromNixMay :: NValue m -> m (Maybe (NThunk m)) Source #

(Convertible e m, MonadEffects m, MonadThunk (NValue m) (NThunk m) m) => FromNix (Text, DList Text) m (NValue m) Source # 
(Convertible e m, MonadEffects m) => FromNix (Text, DList Text) 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 # 
(Convertible e m, MonadThunk (NValue m) (NThunk m) m, FromNix a m (NValue m)) => FromNix (HashMap Text a) m (NValue m) Source # 

Methods

fromNix :: NValue m -> m (HashMap Text a) Source #

fromNixMay :: NValue m -> m (Maybe (HashMap Text a)) Source #

Convertible e m => FromNix (HashMap Text (NValueNF m)) m (NValueNF m) Source # 

class ToNix a m v where Source #

Methods

toNix :: a -> m v Source #

toNix :: ToValue a m v => a -> m v Source #

Instances

Applicative m => ToNix Bool m (NExprF r) Source # 

Methods

toNix :: Bool -> m (NExprF r) Source #

Applicative m => ToNix Bool m (NValue m) Source # 

Methods

toNix :: Bool -> m (NValue m) Source #

Applicative m => ToNix Bool m (NValueNF m) Source # 

Methods

toNix :: Bool -> m (NValueNF m) Source #

Applicative m => ToNix Float m (NValue m) Source # 

Methods

toNix :: Float -> m (NValue m) Source #

Applicative m => ToNix Float m (NValueNF m) Source # 

Methods

toNix :: Float -> m (NValueNF m) Source #

Applicative m => ToNix Int m (NValue m) Source # 

Methods

toNix :: Int -> m (NValue m) Source #

Applicative m => ToNix Int m (NValueNF m) Source # 

Methods

toNix :: Int -> m (NValueNF m) Source #

Applicative m => ToNix Integer m (NValue m) Source # 

Methods

toNix :: Integer -> m (NValue m) Source #

Applicative m => ToNix Integer m (NValueNF m) Source # 

Methods

toNix :: Integer -> m (NValueNF m) Source #

Applicative m => ToNix () m (NExprF r) Source # 

Methods

toNix :: () -> m (NExprF r) Source #

Applicative m => ToNix () m (NValue m) Source # 

Methods

toNix :: () -> m (NValue m) Source #

Applicative m => ToNix () m (NValueNF m) Source # 

Methods

toNix :: () -> m (NValueNF m) Source #

(MonadThunk (NValue m) (NThunk m) m, ToNix a m (NValue m)) => ToNix a m (NThunk m) Source # 

Methods

toNix :: a -> m (NThunk m) Source #

Applicative m => ToNix ByteString m (NValue m) Source # 

Methods

toNix :: ByteString -> m (NValue m) Source #

Applicative m => ToNix ByteString m (NValueNF m) Source # 

Methods

toNix :: ByteString -> m (NValueNF m) Source #

Applicative m => ToNix Text m (NValue m) Source # 

Methods

toNix :: Text -> m (NValue m) Source #

Applicative m => ToNix Text m (NValueNF m) Source # 

Methods

toNix :: Text -> m (NValueNF m) Source #

(Convertible e m, MonadThunk (NValue m) (NThunk m) m) => ToNix Value m (NValue m) Source # 

Methods

toNix :: Value -> m (NValue m) Source #

Applicative m => ToNix Path m (NValue m) Source # 

Methods

toNix :: Path -> m (NValue m) Source #

Applicative m => ToNix Path m (NValueNF m) Source # 

Methods

toNix :: Path -> m (NValueNF m) Source #

(Applicative m, ToNix a m (NValueNF m)) => ToNix [a] m (NValueNF m) Source # 

Methods

toNix :: [a] -> m (NValueNF m) Source #

(Convertible e m, MonadThunk (NValue m) (NThunk m) m, ToNix a m (NValue m)) => ToNix [a] m (NValue m) Source # 

Methods

toNix :: [a] -> m (NValue m) Source #

MonadThunk (NValue m) (NThunk m) m => ToNix (NThunk m) m (NValue m) Source # 

Methods

toNix :: NThunk m -> m (NValue m) Source #

Applicative m => ToNix (Text, DList Text) m (NValue m) Source # 

Methods

toNix :: (Text, DList Text) -> m (NValue m) Source #

Applicative m => ToNix (Text, DList Text) m (NValueNF m) Source # 

Methods

toNix :: (Text, DList Text) -> m (NValueNF 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, MonadThunk (NValue m) (NThunk m) m, ToNix a m (NValue m)) => ToNix (HashMap Text a) m (NValue m) Source # 

Methods

toNix :: HashMap Text a -> m (NValue m) Source #

Applicative m => ToNix (HashMap Text (NValueNF m)) m (NValueNF m) Source # 

Methods

toNix :: HashMap Text (NValueNF m) -> m (NValueNF m) Source #

convertNix :: forall a t m v. (FromNix a m t, ToNix a m v, Monad m) => t -> m v Source #