Copyright | (C) 2016 Csongor Kiss |
---|---|
License | BSD3 |
Maintainer | Csongor Kiss <kiss.csongor.kiss@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Data.Type.Regex
Contents
Description
Match Haskell types with regular expressions using nondeterministic finite automata constructed at the type level.
Matching
The constraint is satisfied when the input
matches the given regular
expression re
.
example :: ('[a] ~= (Int :| Char)) => a -> a example = id
The functon example
can only satisfy the types `Int -> Int' and `Char ->
Char`'.
Combinators
type (:>) a b = Seq (ToTerm a) (ToTerm b) Source
Sequence regular expression terms. The traditional regular expression matched character-by-character, in that case, this sequencing would delimit character-rules. Here, we're matching types in a type-level list. (as opposed to characters in a list, aka String)