Add train and further methods for extending thunk actions

This commit is contained in:
John Wiegley 2019-03-18 12:51:29 -07:00
parent 522585a7f1
commit be7b289b02
No known key found for this signature in database
GPG key ID: C144D8F4F19FE630
2 changed files with 7 additions and 0 deletions

View file

@ -38,6 +38,9 @@ class MonadThunkId m => MonadThunk t m a | t -> m, t -> a where
queryM :: t -> m r -> (a -> m r) -> m r
force :: t -> (a -> m r) -> m r
forceEff :: t -> (a -> m r) -> m r
-- | Modify the action to be performed by the thunk. For some implicits
-- this modifies the thunk, for others it may create a new thunk.
further :: t -> (m a -> m a) -> m t
newtype ThunkLoop = ThunkLoop String -- contains rendering of ThunkId
deriving Typeable

View file

@ -6,3 +6,7 @@ module Nix.Value.Monad where
class MonadValue v m where
defer :: m v -> m v
demand :: v -> (v -> m r) -> m r
-- | If 'v' is a thunk, 'train' allows us to modify the action to be
-- peformed by the thunk, perhaps by enriching it with scpoe info, for
-- example.
train :: v -> (m v -> m v) -> m v