Copyright | (c) gspia 2020- |
---|---|
License | BSD |
Maintainer | gspia |
Safe Haskell | Safe |
Language | Haskell2010 |
Fcf.Alg.Symbol
Type-level symbols and functions for them.
Note that the operators from this module conflict with GHC.TypeLits.
TODO: Would this whole module have a place first-class-families?
Synopsis
- module Fcf.Data.Symbol
- data Append :: Symbol -> Symbol -> Exp Symbol
- data Intercalate :: Symbol -> [Symbol] -> Exp Symbol
- data IsSpace :: Symbol -> Exp Bool
- data IsNewLine :: Symbol -> Exp Bool
- data IsTab :: Symbol -> Exp Bool
- data IsSpaceDelim :: Symbol -> Exp Bool
- data IsDigit :: Symbol -> Exp Bool
- data SymbolOrd :: Symbol -> Symbol -> Exp Ordering
- data (<=) :: Symbol -> Symbol -> Exp Bool
- data (>=) :: Symbol -> Symbol -> Exp Bool
- data (<) :: Symbol -> Symbol -> Exp Bool
- data (>) :: Symbol -> Symbol -> Exp Bool
- data (==) :: Symbol -> Symbol -> Exp Bool
Reexported type
From Fcf.Data.Symbol (which is from GHC).
module Fcf.Data.Symbol
Functions
data Append :: Symbol -> Symbol -> Exp Symbol Source #
Append two type-level symbols.
Example
>>>
:kind! Eval (Append "hmm" " ok")
Eval (Append "hmm" " ok") :: Symbol = "hmm ok"
data Intercalate :: Symbol -> [Symbol] -> Exp Symbol Source #
Intercalate type-level symbols.
Example
>>>
:kind! Eval (Intercalate "+" '["aa", "bb", "cc"])
Eval (Intercalate "+" '["aa", "bb", "cc"]) :: Symbol = "aa+bb+cc"
>>>
:kind! Eval (Intercalate "+" '["aa"])
Eval (Intercalate "+" '["aa"]) :: Symbol = "aa"
>>>
:kind! Eval (Intercalate "+" '[])
Eval (Intercalate "+" '[]) :: Symbol = ""
Instances
type Eval (Intercalate s1 ([] :: [Symbol]) :: Symbol -> Type) Source # | |
Defined in Fcf.Alg.Symbol | |
type Eval (Intercalate s1 (s ': sLst) :: Symbol -> Type) Source # | |
Defined in Fcf.Alg.Symbol |
data IsSpace :: Symbol -> Exp Bool Source #
IsSpace
Example
>>>
:kind! Eval (IsSpace "a")
Eval (IsSpace "a") :: Bool = 'False
>>>
:kind! Eval (IsSpace " ")
Eval (IsSpace " ") :: Bool = 'True
data IsNewLine :: Symbol -> Exp Bool Source #
IsNewline
Example
>>>
:kind! Eval (IsNewLine "a")
Eval (IsNewLine "a") :: Bool = 'False
>>>
:kind! Eval (IsNewLine "\n")
Eval (IsNewLine "\n") :: Bool = 'True
data IsTab :: Symbol -> Exp Bool Source #
IsTab
Example
>>>
:kind! Eval (IsTab "a")
Eval (IsTab "a") :: Bool = 'False
>>>
:kind! Eval (IsTab "\t")
Eval (IsTab "\t") :: Bool = 'True
data IsSpaceDelim :: Symbol -> Exp Bool Source #
IsSpaceDelim
Example
>>>
:kind! Eval (IsSpaceDelim "a")
Eval (IsSpaceDelim "a") :: Bool = 'False
>>>
:kind! Eval (IsSpaceDelim "\n")
Eval (IsSpaceDelim "\n") :: Bool = 'True
data IsDigit :: Symbol -> Exp Bool Source #
IsDigit
Example
>>>
:kind! Eval (IsDigit "3")
Eval (IsDigit "3") :: Bool = 'True
>>>
:kind! Eval (IsDigit "a")
Eval (IsDigit "a") :: Bool = 'False
Comparison functions
data SymbolOrd :: Symbol -> Symbol -> Exp Ordering Source #
SymbolOrd - compare two symbols and give type-level Ordering ( $ 'LT $, $ 'EQ $ or $ 'GT $ ).
Example
>>>
:kind! Eval (SymbolOrd "a" "b")
Eval (SymbolOrd "a" "b") :: Ordering = 'LT
data (<=) :: Symbol -> Symbol -> Exp Bool Source #
Less-than-or-equal comparison for symbols.
Example
>>>
:kind! Eval ("b" <= "a")
Eval ("b" <= "a") :: Bool = 'False
data (>=) :: Symbol -> Symbol -> Exp Bool Source #
Larger-than-or-equal comparison for symbols.
Example
>>>
:kind! Eval ("b" >= "a")
Eval ("b" >= "a") :: Bool = 'True
data (<) :: Symbol -> Symbol -> Exp Bool Source #
Less-than comparison for symbols.
Example
>>>
:kind! Eval ("a" < "b")
Eval ("a" < "b") :: Bool = 'True