{-# LANGUAGE NoImplicitPrelude #-}

-- | This module provides a first-class version
-- of the "Data.Text" module.
module ModularPrelude.Module.Text
  ( -- * Module interface
    TextModule (..)
    -- * Module contents
  , TextImplements (..)
  ) where


import ModularPrelude hiding (empty)
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
import qualified Filesystem.Path.CurrentOS as FilePath


data TextModule = Text
  { TextModule -> (Char -> Char) -> Text -> Text
map       :: (Char -> Char) -> Text -> Text
  , TextModule -> (Char -> Text) -> Text -> Text
concatMap :: (Char -> Text) -> Text -> Text
  , TextModule -> (Char -> Bool) -> Text -> Text
filter    :: (Char -> Bool) -> Text -> Text
  , TextModule -> Text -> Int
length    :: Text -> Int
  , TextModule -> Char -> Text
singleton :: Char -> Text
  , TextModule -> Text -> Bool
null      :: Text -> Bool
  , TextModule -> [Char] -> Text
pack      :: [Char] -> Text
  , TextModule -> Text -> [Char]
unpack    :: Text -> [Char]
  , TextModule -> Text
empty     :: Text
  , TextModule -> FilePath -> IO Text
readFile  :: FilePath -> IO Text
  , TextModule -> FilePath -> Text -> IO ()
writeFile :: FilePath -> Text -> IO ()
  , TextModule -> (Char -> Bool) -> Text -> (Text, Text)
break     :: (Char -> Bool) -> Text -> (Text, Text)
  , TextModule -> (Char -> Bool) -> Text -> (Text, Text)
span      :: (Char -> Bool) -> Text -> (Text, Text)
  , TextModule -> (Char -> Bool) -> Text -> Text
dropWhile :: (Char -> Bool) -> Text -> Text
  , TextModule -> (Char -> Bool) -> Text -> Text
takeWhile :: (Char -> Bool) -> Text -> Text
  , TextModule -> (Char -> Bool) -> Text -> Bool
any       :: (Char -> Bool) -> Text -> Bool
  , TextModule -> (Char -> Bool) -> Text -> Bool
all       :: (Char -> Bool) -> Text -> Bool
  , TextModule -> Int -> Text -> (Text, Text)
splitAt   :: Int -> Text -> (Text, Text)
  }


class TextImplements interface where
  _Data_Text_ :: interface

instance TextImplements TextModule where
  _Data_Text_ :: TextModule
_Data_Text_ = Text
    { map :: (Char -> Char) -> Text -> Text
map       = (Char -> Char) -> Text -> Text
Text.map
    , concatMap :: (Char -> Text) -> Text -> Text
concatMap = (Char -> Text) -> Text -> Text
Text.concatMap
    , filter :: (Char -> Bool) -> Text -> Text
filter    = (Char -> Bool) -> Text -> Text
Text.filter
    , length :: Text -> Int
length    = Text -> Int
Text.length
    , singleton :: Char -> Text
singleton = Char -> Text
Text.singleton
    , null :: Text -> Bool
null      = Text -> Bool
Text.null
    , pack :: [Char] -> Text
pack      = [Char] -> Text
Text.pack
    , unpack :: Text -> [Char]
unpack    = Text -> [Char]
Text.unpack
    , empty :: Text
empty     = Text
Text.empty
    , readFile :: FilePath -> IO Text
readFile  = [Char] -> IO Text
Text.readFile ([Char] -> IO Text) -> (FilePath -> [Char]) -> FilePath -> IO Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. FilePath -> [Char]
FilePath.encodeString
    , writeFile :: FilePath -> Text -> IO ()
writeFile = [Char] -> Text -> IO ()
Text.writeFile ([Char] -> Text -> IO ())
-> (FilePath -> [Char]) -> FilePath -> Text -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. FilePath -> [Char]
FilePath.encodeString
    , break :: (Char -> Bool) -> Text -> (Text, Text)
break     = (Char -> Bool) -> Text -> (Text, Text)
Text.break
    , span :: (Char -> Bool) -> Text -> (Text, Text)
span      = (Char -> Bool) -> Text -> (Text, Text)
Text.span
    , dropWhile :: (Char -> Bool) -> Text -> Text
dropWhile = (Char -> Bool) -> Text -> Text
Text.dropWhile
    , takeWhile :: (Char -> Bool) -> Text -> Text
takeWhile = (Char -> Bool) -> Text -> Text
Text.takeWhile
    , any :: (Char -> Bool) -> Text -> Bool
any       = (Char -> Bool) -> Text -> Bool
Text.any
    , all :: (Char -> Bool) -> Text -> Bool
all       = (Char -> Bool) -> Text -> Bool
Text.all
    , splitAt :: Int -> Text -> (Text, Text)
splitAt   = Int -> Text -> (Text, Text)
Text.splitAt
    }


instance Default TextModule where
  def :: TextModule
def = TextModule
forall interface. TextImplements interface => interface
_Data_Text_