Last active
May 31, 2017 11:07
-
-
Save int-index/d35255377b1ee05780eb9e006959bccb to your computer and use it in GitHub Desktop.
Polyconstraints Exercise: @int-index solution
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 MultiParamTypeClasses, FlexibleInstances, | |
TypeOperators, UndecidableInstances #-} | |
{-# LANGUAGE RankNTypes, ScopedTypeVariables, ConstraintKinds #-} | |
import Data.Constraint | |
import Data.Constraint.Forall | |
class C1 a b | |
class C2 a b | |
instance C1 a b => C2 a b | |
entl :: forall a . (Forall (C1 a)) :- (Forall (C2 a)) | |
entl = Sub (forall (case inst :: forall b . Forall (C1 a) :- C1 a b of | |
Sub (Dict :: Dict (C1 a b)) -> Dict :: Dict (C2 a b))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment