Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.StaticText.Class
Description
Class of statically-sized text-like types.
Documentation
class IsStaticText a where Source #
Class of types which can be assigned a type-level length.
Associated Types
data Static a (i :: Nat) Source #
Data family which wraps values of the underlying type giving
them a type-level length. Static t 6
means a value of type t
of
length 6.
Basic element type. For IsStaticText [a]
, this is a
.
Methods
unsafeCreate :: a -> Static a i Source #
Simply wrap a value in a Static as is, assuming any length.
When implementing new IsStaticText instances, make this simply apply the constructor of Static.
This should only be used to implement IsStaticText.
For example, an expression like
>>>
unsafeCreate "somestring" :: Static String 50
"somestring"
will typecheck, although the stored length information will not match actual string size. This may result in wrong behaviour of all functions defined for IsStaticText.
unwrap :: Static a i -> a Source #
Forget type-level length, obtaining the underlying value.
append :: a -> a -> a Source #
replicate :: Int -> Elem a -> a Source #
map :: (Elem a -> Elem a) -> a -> a Source #