Skip to content

Instantly share code, notes, and snippets.

@unktomi
Created February 18, 2024 19:37
Show Gist options
  • Save unktomi/1f6ca59770cb4cbca6b2e953c4b7d85d to your computer and use it in GitHub Desktop.
Save unktomi/1f6ca59770cb4cbca6b2e953c4b7d85d to your computer and use it in GitHub Desktop.
CoCont CoSelection
{-# LANGUAGE GADTs, RankNTypes #-}
newtype Const a b = Const { getConst :: a }
newtype Ran g h a = Ran { runRan :: forall r. (a -> g r) -> h r }
data Lan g h a where
Lan :: h i -> (g i -> a) -> Lan g h a
type Cont r a = Ran (Const r) (Const r) a
type Selection r a = Ran (Const r) (Const a) a
type CoCont r a = Lan (Const r) (Const r) a
type CoSelection r a = Lan (Const r) (Const a) a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment