Created
January 18, 2019 18:49
-
-
Save danidiaz/747bc70588d2488aa2ef7ee57d5fa9d8 to your computer and use it in GitHub Desktop.
kind class example
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 RankNTypes, DataKinds, TypeInType, PolyKinds, FlexibleInstances #-} | |
import Data.Proxy | |
import GHC.TypeLits | |
class Foo k | |
class Foo k => Bar (a :: k) where | |
baz :: Proxy a -> String | |
instance Foo k => Bar (a :: k) where | |
baz _ = "baz" | |
instance Foo Nat | |
printMsg :: forall (x :: Nat) . Proxy x -> IO () | |
printMsg p = print $ baz p | |
main :: IO () | |
main = return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment