Skip to content

Instantly share code, notes, and snippets.

@andrewthad
Created September 20, 2018 23:42
Show Gist options
  • Save andrewthad/03780afc2a0180ad18758fe82e0bb30e to your computer and use it in GitHub Desktop.
Save andrewthad/03780afc2a0180ad18758fe82e0bb30e to your computer and use it in GitHub Desktop.
Quantified Constraints with a Multi-Param Type Class
{-# 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)
@andrewthad
Copy link
Author

I just wanted to confirm that this compiled before I attempted to apply in to a real problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment