|
19 | 19 | {-# LANGUAGE UndecidableInstances #-} |
20 | 20 | {-# LANGUAGE ViewPatterns #-} |
21 | 21 |
|
22 | | -{-# OPTIONS_GHC -Wno-missing-signatures #-} |
23 | 22 | {-# OPTIONS_GHC -fno-warn-name-shadowing #-} |
24 | 23 |
|
25 | 24 | -- | Code that implements Nix builtins. Lists the functions that are built into the Nix expression evaluator. Some built-ins (aka `derivation`), are always in the scope, so they can be accessed by the name. To keap the namespace clean, most built-ins are inside the `builtins` scope - a set that contains all what is a built-in. |
@@ -660,6 +659,7 @@ splitMatches numDropped (((_, (start, len)) : captures) : mts) haystack = |
660 | 659 | caps = nvList (map f captures) |
661 | 660 | f (a, (s, _)) = if s < 0 then nvConstant NNull else thunkStr a |
662 | 661 |
|
| 662 | +thunkStr :: Applicative f => ByteString -> NValue t f m |
663 | 663 | thunkStr s = nvStr (makeNixStringWithoutContext (decodeUtf8 s)) |
664 | 664 |
|
665 | 665 | substring :: forall e t f m. MonadNix e t f m => Int -> Int -> NixString -> Prim m NixString |
@@ -1513,16 +1513,16 @@ newtype Prim m a = Prim { runPrim :: m a } |
1513 | 1513 |
|
1514 | 1514 | -- | Types that support conversion to nix in a particular monad |
1515 | 1515 | class ToBuiltin t f m a | a -> m where |
1516 | | - toBuiltin :: String -> a -> m (NValue t f m) |
| 1516 | + toBuiltin :: String -> a -> m (NValue t f m) |
1517 | 1517 |
|
1518 | 1518 | instance (MonadNix e t f m, ToValue a m (NValue t f m)) |
1519 | | - => ToBuiltin t f m (Prim m a) where |
| 1519 | + => ToBuiltin t f m (Prim m a) where |
1520 | 1520 | toBuiltin _ p = toValue =<< runPrim p |
1521 | 1521 |
|
1522 | 1522 | instance ( MonadNix e t f m |
1523 | 1523 | , FromValue a m (Deeper (NValue t f m)) |
1524 | 1524 | , ToBuiltin t f m b |
1525 | 1525 | ) |
1526 | | - => ToBuiltin t f m (a -> b) where |
| 1526 | + => ToBuiltin t f m (a -> b) where |
1527 | 1527 | toBuiltin name f = |
1528 | 1528 | pure $ nvBuiltin name (fromValue . Deeper >=> toBuiltin name . f) |
0 commit comments