Skip to content

Instantly share code, notes, and snippets.

@danidiaz
Created January 18, 2019 18:49
Show Gist options
  • Select an option

  • Save danidiaz/747bc70588d2488aa2ef7ee57d5fa9d8 to your computer and use it in GitHub Desktop.

Select an option

Save danidiaz/747bc70588d2488aa2ef7ee57d5fa9d8 to your computer and use it in GitHub Desktop.
kind class example
{-# 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