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

Add Control.Effect.Sum.Project.

Fixes #289.
This commit is contained in:
Patrick Thomson 2019-11-08 12:20:43 -05:00
parent b60491714f
commit f2f5eccdeb
2 changed files with 22 additions and 0 deletions

View File

@ -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

View 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