Remove the Convertible type constraint synonym

This commit is contained in:
John Wiegley 2018-04-11 14:16:33 -07:00
parent 27c3875934
commit 031826f01b
3 changed files with 11 additions and 16 deletions

View file

@ -72,9 +72,12 @@ class (Show v, Monoid (MText v),
embedMText :: MText v -> m v
projectMText :: v -> m (Maybe (Maybe (MText v)))
type MonadNixEval e v t m
= (MonadEval v m, Scoped e t m, Convertible v t, MonadThunk v t m,
MonadFix m)
type MonadNixEval e v t m =
(MonadEval v m, Scoped e t m, MonadThunk v t m, MonadFix m,
ConvertValue v Bool,
ConvertValue v [t],
ConvertValue v (AttrSet t),
ConvertValue v (AttrSet t, AttrSet SourcePos))
-- | Evaluate an nix expression, with a given NThunkSet as environment
evalExpr :: MonadNixEval e v t m => NExpr -> m v

View file

@ -309,14 +309,3 @@ stripPositionInfo = transport phi
class ConvertValue v a where
ofVal :: a -> v
wantVal :: v -> Maybe a
type Convertible v t =
(ConvertValue v Bool,
ConvertValue v Int,
ConvertValue v Integer,
ConvertValue v Float,
ConvertValue v Text,
ConvertValue v (Maybe Text), -- text or null
ConvertValue v [t],
ConvertValue v (AttrSet t, AttrSet SourcePos),
ConvertValue v (AttrSet t))

View file

@ -109,8 +109,11 @@ builtin3 :: Monad m
builtin3 name f =
builtin name $ \a -> builtin name $ \b -> builtin name $ \c -> f a b c
posFromSourcePos :: forall m v t. (MonadThunk v t m, Convertible v t)
=> SourcePos -> v
posFromSourcePos
:: forall m v t.
(MonadThunk v t m, ConvertValue v Int, ConvertValue v Text,
ConvertValue v (AttrSet t))
=> SourcePos -> v
posFromSourcePos (SourcePos f l c) =
ofVal $ M.fromList
[ ("file" :: Text, value @_ @_ @m $ ofVal (pack f))