Last active
February 14, 2020 22:58
-
-
Save Pitometsu/1c5f84265137f6967c40d632788796f9 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 DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE OverloadedLabels #-} | |
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE UnicodeSyntax #-} | |
{-# LANGUAGE PatternSynonyms #-} | |
{-# LANGUAGE ExplicitNamespaces #-} | |
{-# LANGUAGE RoleAnnotations #-} | |
import GHC.OverloadedLabels (type IsLabel, fromLabel) | |
import GHC.TypeLits (pattern SomeSymbol, type Symbol, type KnownSymbol) | |
import Data.Kind (type Type) | |
import Data.Proxy (pattern Proxy, type Proxy) | |
type role With nominal | |
data With ∷ Symbol → Type where | |
With ∷ ∀ (symbol ∷ Symbol). With symbol | |
instance KnownSymbol symbol ⇒ Show (With symbol) where | |
show = const do show do SomeSymbol do Proxy @symbol | |
instance IsLabel symbol (With symbol) where | |
fromLabel = With @symbol | |
main = print hello'world | |
where | |
hello'world = #hello'world ∷ With "hello'world" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment