Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Documentation
type family Head (sym :: Symbol) :: Symbol where ... Source #
Compute the first character of a type-level symbol
>>>
:kind! Head "Example"
Head "Example" :: Symbol = "E"
>>>
:kind! Head ""
Head "" :: Symbol = ""
Head
doesn't fail if the first character is ASCII, rest is irrelevant
>>>
:kind! Head "123±456"
Head "123±456" :: Symbol = "1"
Head
fails if the first character is non-ASCII
>>>
:kind! Head "±123"
Head "±123" :: Symbol = (TypeError ...)
type family ToList (sym :: Symbol) :: [Symbol] where ... Source #
Convert the symbol into a list of characters
>>>
:kind! ToList "ABC"
ToList "ABC" :: [Symbol] = '["A", "B", "C"]
ToList
works only for ASCII strings
>>>
:kind! ToList "123±456"
ToList "123±456" :: [Symbol] = "1" : "2" : "3" : (TypeError ...)
ToList sym = ToList1 sym "" |