Skip to content

Instantly share code, notes, and snippets.

@Pitometsu
Last active February 14, 2020 22:58
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 Pitometsu/1c5f84265137f6967c40d632788796f9 to your computer and use it in GitHub Desktop.
Save Pitometsu/1c5f84265137f6967c40d632788796f9 to your computer and use it in GitHub Desktop.
{-# 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