module RFC.Miso.String
( module RFC.Miso.String
, module Miso.String
) where
import Data.String ()
import Miso.String (MisoString, ToMisoString (..))
import RFC.Data.UUID ()
import RFC.String ()
#ifdef GHCJS
import Data.MonoTraversable
import qualified Data.Text.Lazy as TL
import RFC.Prelude
type instance Element MisoString = Char
instance MonoFunctor MisoString where
omap :: (Char -> Char) -> MisoString -> MisoString
omap f = toMisoString . omap f . toLazyText
instance MonoFoldable MisoString where
ofoldMap f = ofoldr (mappend . f) mempty
ofoldr :: (Char -> a -> a) -> a -> MisoString -> a
ofoldr f init str = TL.foldr f init $ toLazyText str
ofoldl' :: (a -> Char -> a) -> a -> MisoString -> a
ofoldl' f init str = TL.foldl' f init $ toLazyText str
otoList = ofoldr (:) []
oall f str = TL.all f $ toLazyText str
oany :: (Char -> Bool) -> MisoString -> Bool
oany f str = TL.any f $ toLazyText str
onull = TL.null . toLazyText
olength64 = TL.length . toLazyText
ofoldr1Ex :: (Char -> Char -> Char) -> MisoString -> Char
ofoldr1Ex f str = TL.foldr1 f $ toLazyText str
ofoldl1Ex' :: (Char -> Char -> Char) -> MisoString -> Char
ofoldl1Ex' f str = TL.foldl1' f $ toLazyText str
headEx = TL.head . toLazyText
lastEx = TL.last . toLazyText
instance FromText MisoString where
fromText :: Text -> MisoString
fromText = toMisoString
instance ToText MisoString where
toText :: MisoString -> Text
toText = fromMisoString
#endif