Skip to content

Instantly share code, notes, and snippets.

@parsonsmatt
Created October 10, 2017 00:06
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 parsonsmatt/5fa1abcccbec800752351874a54d863a to your computer and use it in GitHub Desktop.
Save parsonsmatt/5fa1abcccbec800752351874a54d863a to your computer and use it in GitHub Desktop.
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
module TyCon where
import GHC.Exts (Constraint)
import Data.Text (Text)
type family AcceptableKids kids tag :: Constraint where
AcceptableKids kids "span" = kids ~ String
AcceptableKids kids div = ()
ayyylmao :: forall tag kids. (Show kids, AcceptableKids kids tag) => kids -> IO ()
ayyylmao kids = print kids
main :: IO ()
main = do
ayyylmao @"span" "gotta be a string my dude"
ayyylmao @"div" [1, 2, 3]
ayyylmao @"asdf" ("who are you even" :: Text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment