Created
May 22, 2019 14:27
-
-
Save YuMingLiao/34b05f74ffae5a389a5cb5d4dcebcc8e 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 OverloadedLabels #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
import Data.String | |
import GHC.OverloadedLabels | |
import GHC.TypeLits | |
import Data.Proxy | |
data Html = Html String [String] [Html] | String String deriving (Show) | |
-- Expected type: [inner] -> Html | |
-- Actual type: [String] -> [Html] -> Html | |
-- • Probable cause: ‘Html’ is applied to too few arguments | |
instance IsString Html where fromString = String | |
instance (KnownSymbol symbol,attr ~ String,inner ~ Html) => IsLabel symbol ([attr] -> [inner] -> Html) where | |
fromLabel p = Html (symbolVal' (Proxy :: Proxy symbol)) | |
instance (KnownSymbol symbol,attr ~ String,inner ~ Html) => IsLabel symbol ([inner] -> Html) where | |
fromLabel p = Html (symbolVal' p) [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment