Created
October 25, 2019 20:17
-
-
Save dmwit/0bf2b43eaf537066d7c1493a2beeb7e8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ConstraintKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
import GHC.Types | |
class Foo f where | |
type Ctx f i :: Constraint | |
extract :: Ctx f i => i -> f i -> String | |
newtype Los i = Los [String] deriving (Eq, Ord, Read, Show) | |
instance Foo Los where | |
type Ctx Los i = i ~ Int | |
extract i (Los ss) = ss !! i | |
data Extractor f i = Extractor | |
{ idx :: i | |
, unrelated :: f i | |
} deriving (Eq, Ord, Read, Show) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment