overloaded-records-0.4.2.0: Overloaded Records based on current GHC proposal.

Copyright(c) 2016, Peter Trško
LicenseBSD3
Maintainerpeter.trsko@gmail.com
Stabilityexperimental
PortabilityGHC specific language extensions.
Safe HaskellNone
LanguageHaskell2010

Data.OverloadedLabels

Contents

Description

This module defines the IsLabel class which is used by the OverloadedLabels language extension. See the wiki page for more details.

The key idea is that when GHC sees an occurrence of the new overloaded label syntax #foo, it is replaced with

fromLabel (proxy# :: Proxy# "foo") :: alpha

plus a wanted constraint IsLabel "foo" alpha.

On GHC >=8.0.1 we just reexport GHC.OverloadedLabels module.

Synopsis

Oveloaded Labels

data Label l Source #

Since 0.4.2.0

Constructors

Label (Proxy# l) 

Instances

(~) Symbol l1 l2 => IsLabel l1 (Label l2) Source #

Since 0.4.2.0

Methods

fromLabel :: Proxy# Symbol l1 -> Label l2 #

KnownSymbol l => Show (Label l) Source #

Since 0.4.2.0

Methods

showsPrec :: Int -> Label l -> ShowS #

show :: Label l -> String #

showList :: [Label l] -> ShowS #

getLabel :: Label l -> Label l Source #

Type restricted identity function.

Since 0.4.2.0

showLabel :: KnownSymbol l => Label l -> String Source #

Type restricted version of show.

>>> showLabel #foo
#foo

Since 0.4.2.0

unLabel :: IsLabel l a => Label l -> a Source #

Same as fromLabel, but works for Label data type.

Since 0.4.2.0