-
-
Save kosmikus/237946a2335600690208a4a36efef988 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeOperators, GADTs, FlexibleContexts, DataKinds, RankNTypes, PolyKinds, TypeFamilies, MultiParamTypeClasses, UndecidableInstances, UndecidableSuperClasses, FlexibleInstances, ConstraintKinds, TypeApplications, EmptyCase, ScopedTypeVariables, PartialTypeSignatures, TemplateHaskell #-} | |
module Partition where | |
import Data.Coerce | |
import Data.Kind | |
import Data.Proxy | |
data NP (f :: k -> Type) (xs :: [k]) where | |
Nil :: NP f '[] | |
(:*) :: f x -> NP f xs -> NP f (x : xs) | |
infixr 5 :* | |
strictToPair :: forall f a b . NP f '[a, b] -> (f a, f b) | |
strictToPair np = | |
case np of | |
(fx :* fxs) -> | |
case (fxs {- :: NP f '[b] -}) of | |
(fy :* fys) -> | |
(fx, fy) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment