mirror of
https://github.com/github/semantic.git
synced 2024-12-26 00:12:29 +03:00
parent
b60491714f
commit
f2f5eccdeb
@ -116,6 +116,7 @@ library
|
||||
, Control.Effect.Interpose
|
||||
, Control.Effect.Parse
|
||||
, Control.Effect.REPL
|
||||
, Control.Effect.Sum.Project
|
||||
, Control.Rewriting
|
||||
-- Datatypes for abstract interpretation
|
||||
, Data.Abstract.Address.Hole
|
||||
|
21
src/Control/Effect/Sum/Project.hs
Normal file
21
src/Control/Effect/Sum/Project.hs
Normal file
@ -0,0 +1,21 @@
|
||||
{-# LANGUAGE FlexibleInstances, KindSignatures, MultiParamTypeClasses, TypeOperators #-}
|
||||
|
||||
module Control.Effect.Sum.Project
|
||||
( Project (..)
|
||||
) where
|
||||
|
||||
import Control.Effect.Sum
|
||||
|
||||
class Member sub sup => Project (sub :: (* -> *) -> (* -> *)) sup where
|
||||
prj :: sup m a -> Maybe (sub m a)
|
||||
|
||||
instance Project sub sub where
|
||||
prj = Just
|
||||
|
||||
instance {-# OVERLAPPABLE #-} Project sub (sub :+: sup) where
|
||||
prj (L f) = Just f
|
||||
prj _ = Nothing
|
||||
|
||||
instance {-# OVERLAPPABLE #-} Project sub sup => Project sub (sub' :+: sup) where
|
||||
prj (R g) = prj g
|
||||
prj _ = Nothing
|
Loading…
Reference in New Issue
Block a user