Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data ASCII superset
- lift :: ASCII superset -> superset
- asciiUnsafe :: superset -> ASCII superset
- validateChar :: CharSuperset superset => superset -> Maybe (ASCII superset)
- fromChar :: CharSuperset superset => Char -> ASCII superset
- toChar :: CharSuperset superset => ASCII superset -> Char
- substituteChar :: CharSuperset superset => superset -> ASCII superset
- asChar :: CharSuperset superset => (Char -> Char) -> ASCII superset -> ASCII superset
- validateString :: StringSuperset superset => superset -> Maybe (ASCII superset)
- fromCharList :: StringSuperset superset => [Char] -> ASCII superset
- toCharList :: StringSuperset superset => ASCII superset -> [Char]
- substituteString :: StringSuperset superset => superset -> ASCII superset
- mapChars :: StringSuperset superset => (Char -> Char) -> ASCII superset -> ASCII superset
ASCII type constructor
This type constructor indicates that a value from some ASCII superset is valid ASCII. The type parameter is the ASCII superset, which should be a type with an instance of either CharSuperset
or StringSuperset
.
For example, whereas a Text
value may contain a combination of ASCII and non-ASCII characters, a value of type
may contain only ASCII characters.ASCII
Text
Instances
Eq superset => Eq (ASCII superset) Source # | |
Data superset => Data (ASCII superset) Source # | |
Defined in ASCII.Refinement gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ASCII superset -> c (ASCII superset) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ASCII superset) # toConstr :: ASCII superset -> Constr # dataTypeOf :: ASCII superset -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ASCII superset)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ASCII superset)) # gmapT :: (forall b. Data b => b -> b) -> ASCII superset -> ASCII superset # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ASCII superset -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ASCII superset -> r # gmapQ :: (forall d. Data d => d -> u) -> ASCII superset -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ASCII superset -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ASCII superset -> m (ASCII superset) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ASCII superset -> m (ASCII superset) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ASCII superset -> m (ASCII superset) # | |
Ord superset => Ord (ASCII superset) Source # | |
Defined in ASCII.Refinement compare :: ASCII superset -> ASCII superset -> Ordering # (<) :: ASCII superset -> ASCII superset -> Bool # (<=) :: ASCII superset -> ASCII superset -> Bool # (>) :: ASCII superset -> ASCII superset -> Bool # (>=) :: ASCII superset -> ASCII superset -> Bool # | |
Show superset => Show (ASCII superset) Source # | |
Generic (ASCII superset) Source # | |
Semigroup superset => Semigroup (ASCII superset) Source # | |
Monoid superset => Monoid (ASCII superset) Source # | |
Hashable superset => Hashable (ASCII superset) Source # | |
Defined in ASCII.Refinement | |
StringSuperset string => StringSuperset (ASCII string) Source # | |
Defined in ASCII.Refinement isAsciiString :: ASCII string -> Bool Source # fromCharList :: [Char] -> ASCII string Source # toCharListUnsafe :: ASCII string -> [Char] Source # toCharListSub :: ASCII string -> [Char] Source # substituteString :: ASCII string -> ASCII string Source # mapCharsUnsafe :: (Char -> Char) -> ASCII string -> ASCII string Source # | |
CharSuperset char => CharSuperset (ASCII char) Source # | |
StringSuperset string => StringIso (ASCII string) Source # | |
CharSuperset char => CharIso (ASCII char) Source # | |
Lift (ASCII superset) superset Source # | A value from an ASCII superset that has been refined by the |
Defined in ASCII.Lift | |
type Rep (ASCII superset) Source # | |
Defined in ASCII.Refinement |
asciiUnsafe :: superset -> ASCII superset Source #
Character functions
validateChar :: CharSuperset superset => superset -> Maybe (ASCII superset) Source #
>>>
map validateChar [-1, 65, 97, 128] :: [Maybe (ASCII Int)]
[Nothing,Just (asciiUnsafe 65),Just (asciiUnsafe 97),Nothing]
substituteChar :: CharSuperset superset => superset -> ASCII superset Source #
String functions
validateString :: StringSuperset superset => superset -> Maybe (ASCII superset) Source #
>>>
map validateString ["Hello", "Cristóbal"] :: [Maybe (ASCII Text)]
[Just (asciiUnsafe "Hello"),Nothing]
>>>
map validateString ["Hello", "Cristóbal"] :: [Maybe (ASCII String)]
[Just (asciiUnsafe "Hello"),Nothing]
fromCharList :: StringSuperset superset => [Char] -> ASCII superset Source #
>>>
fromCharList [CapitalLetterH,SmallLetterI,ExclamationMark] :: ASCII Text
asciiUnsafe "Hi!"
toCharList :: StringSuperset superset => ASCII superset -> [Char] Source #
>>>
toCharList (substituteString "Piñata" :: ASCII Text)
[CapitalLetterP,SmallLetterI,Substitute,SmallLetterA,SmallLetterT,SmallLetterA]
substituteString :: StringSuperset superset => superset -> ASCII superset Source #
Forces a string from a larger character set into ASCII by using the Substitute
character in place of any non-ASCII characters.
>>>
substituteString "Cristóbal" :: ASCII Text
asciiUnsafe "Crist\SUBbal"