Created
September 20, 2018 23:42
-
-
Save andrewthad/03780afc2a0180ad18758fe82e0bb30e to your computer and use it in GitHub Desktop.
Quantified Constraints with a Multi-Param Type Class
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 QuantifiedConstraints #-} | |
{-# language MultiParamTypeClasses #-} | |
{-# language UndecidableInstances #-} | |
module QuantifiedMptc where | |
import Data.Functor.Identity | |
import Data.Char | |
class Bar x where | |
bar :: x -> Int | |
class Foo s a where | |
foo :: s -> a -> Bool | |
instance (forall s. Foo s a, Show a) => Bar (Identity a) where | |
bar (Identity x) = fromEnum (foo True x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just wanted to confirm that this compiled before I attempted to apply in to a real problem.