mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Derive a bunch of instances for AllocatorC/DerefC.
This commit is contained in:
parent
d92fd391fd
commit
d86f676856
@ -1,4 +1,4 @@
|
|||||||
{-# LANGUAGE GADTs, KindSignatures, RankNTypes, TypeOperators, UndecidableInstances #-}
|
{-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, KindSignatures, RankNTypes, TypeOperators, UndecidableInstances #-}
|
||||||
module Control.Abstract.Heap
|
module Control.Abstract.Heap
|
||||||
( Heap
|
( Heap
|
||||||
, Live
|
, Live
|
||||||
@ -25,6 +25,7 @@ module Control.Abstract.Heap
|
|||||||
|
|
||||||
import Control.Abstract.Evaluator
|
import Control.Abstract.Evaluator
|
||||||
import Control.Abstract.Roots
|
import Control.Abstract.Roots
|
||||||
|
import Control.Applicative (Alternative)
|
||||||
import Control.Effect.Carrier
|
import Control.Effect.Carrier
|
||||||
import Data.Abstract.BaseError
|
import Data.Abstract.BaseError
|
||||||
import Data.Abstract.Heap
|
import Data.Abstract.Heap
|
||||||
@ -141,6 +142,7 @@ runAllocator :: Carrier (Allocator address :+: sig) (AllocatorC address (Eff m))
|
|||||||
runAllocator = Evaluator . runAllocatorC . interpret . runEvaluator
|
runAllocator = Evaluator . runAllocatorC . interpret . runEvaluator
|
||||||
|
|
||||||
newtype AllocatorC address m a = AllocatorC { runAllocatorC :: m a }
|
newtype AllocatorC address m a = AllocatorC { runAllocatorC :: m a }
|
||||||
|
deriving (Alternative, Applicative, Functor, Monad)
|
||||||
|
|
||||||
|
|
||||||
data Deref value (m :: * -> *) k
|
data Deref value (m :: * -> *) k
|
||||||
@ -162,6 +164,7 @@ runDeref :: Carrier (Deref value :+: sig) (DerefC (Evaluator term address value
|
|||||||
runDeref = runDerefC . interpret . runEvaluator
|
runDeref = runDerefC . interpret . runEvaluator
|
||||||
|
|
||||||
newtype DerefC m a = DerefC { runDerefC :: m a }
|
newtype DerefC m a = DerefC { runDerefC :: m a }
|
||||||
|
deriving (Alternative, Applicative, Functor, Monad)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user