Created
October 10, 2017 00:06
-
-
Save parsonsmatt/5fa1abcccbec800752351874a54d863a to your computer and use it in GitHub Desktop.
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 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