mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Define an HFunctor instance for Env.
This commit is contained in:
parent
78626539c5
commit
39a2df683d
@ -1,8 +1,9 @@
|
||||
{-# LANGUAGE DeriveFunctor, ExistentialQuantification, RankNTypes, StandaloneDeriving #-}
|
||||
{-# LANGUAGE DeriveFunctor, ExistentialQuantification, LambdaCase, RankNTypes, StandaloneDeriving #-}
|
||||
module Analysis.Analysis
|
||||
( Analysis(..)
|
||||
) where
|
||||
|
||||
import Control.Effect.Carrier
|
||||
import Data.Text (Text)
|
||||
|
||||
-- | A record of functions necessary to perform analysis.
|
||||
@ -32,6 +33,13 @@ data Env name addr m k
|
||||
|
||||
deriving instance Functor m => Functor (Env name addr m)
|
||||
|
||||
instance HFunctor (Env name addr) where
|
||||
hmap f = \case
|
||||
Alloc name k -> Alloc name (f . k)
|
||||
Bind name addr m k -> Bind name addr (f m) (f . k)
|
||||
Lookup name k -> Lookup name (f . k)
|
||||
|
||||
|
||||
data Heap addr value m k
|
||||
= Deref addr (Maybe value -> m k)
|
||||
| Assign addr value (m k)
|
||||
|
Loading…
Reference in New Issue
Block a user