Skip to content

Instantly share code, notes, and snippets.

@int-index
Last active May 31, 2017 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save int-index/d35255377b1ee05780eb9e006959bccb to your computer and use it in GitHub Desktop.
Save int-index/d35255377b1ee05780eb9e006959bccb to your computer and use it in GitHub Desktop.
Polyconstraints Exercise: @int-index solution
{-# 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