1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 09:55:52 +03:00

Define a smart constructor for Alloc.

This commit is contained in:
Rob Rix 2019-11-01 14:41:40 -04:00
parent 7508f9c902
commit 1a48a16a44
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -1,6 +1,7 @@
{-# LANGUAGE DeriveFunctor, DeriveGeneric, ExistentialQuantification, LambdaCase, RankNTypes, StandaloneDeriving #-}
{-# LANGUAGE DeriveFunctor, DeriveGeneric, ExistentialQuantification, FlexibleContexts, LambdaCase, RankNTypes, StandaloneDeriving #-}
module Analysis.Analysis
( Analysis(..)
, alloc'
, Env(..)
) where
@ -28,6 +29,10 @@ data Analysis term name address value m = Analysis
, (...) :: address -> name -> m (Maybe address)
}
alloc' :: (Carrier sig m, Member (Env name addr) sig) => name -> m addr
alloc' name = send (Alloc name pure)
data Env name addr m k
= Alloc name (addr -> m k)
| forall a . Bind name addr (m a) (a -> m k)