on 4e4600f help sign in
34 lines 1.3 kB history raw
1-- | This module defines 'PostBuild', which indicates that an action will be
2-- notified when it, and any action it's a part of, has finished executing.
3{-# LANGUAGE CPP #-}
4{-# LANGUAGE DataKinds #-}
5{-# LANGUAGE FlexibleInstances #-}
6{-# LANGUAGE FunctionalDependencies #-}
7{-# LANGUAGE MultiParamTypeClasses #-}
8{-# LANGUAGE ScopedTypeVariables #-}
9{-# LANGUAGE TypeFamilies #-}
10{-# LANGUAGE TypeOperators #-}
11{-# LANGUAGE UndecidableInstances #-}
12#ifdef USE_REFLEX_OPTIMIZER
13{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
14#endif
15module Reflex.PostBuild.Class
16 ( PostBuild (..)
17 ) where
19import Reflex.Class
21import Control.Monad.Reader
23-- | 'PostBuild' represents an action that is notified via an 'Event' when it
24-- has finished executing. Note that the specific definition of "finished" is
25-- determined by the instance of 'PostBuild', but the intent is to allow
26-- 'Behavior's and 'Dynamic's to be safely sampled, regardless of where they
27-- were created, when the post-build 'Event' fires. The post-build 'Event' will
28-- fire exactly once for an given action.
29class (Reflex t, Monad m) => PostBuild t m | m -> t where
30 -- | Retrieve the post-build 'Event' for this action.
31 getPostBuild :: m (Event t ())
33instance PostBuild t m => PostBuild t (ReaderT r m) where
34 getPostBuild = lift getPostBuild