module Principium
  ( --
    module Relude,
    module Optics,
    module WikiMusic.Model.Other,
    module NeatInterpolation,
    BlazeHtml.Html,
    module WikiMusic.SSR.Language,
    module WikiMusic.SSR.Model.Api,
    module WikiMusic.SSR.Model.Env,
    module Free.AlaCarte,
    module WikiMusic.SSR.Model.Config,
    module Data.Time,
    module WikiMusic.SSR.View.Css,
    UUID.UUID,
    --
    maybeDecodeUtf8,
    textToAttrValue,
    maybeDecodeBase16,
    uuidToText,
    intToText,
    unpackText,
    packText,
    filterText,
    MonadError,
    replaceText,
    mapElems,
    mapFromList,
    emptyMap,
    (Map.!?),
    mapFilter,
    setUnion,
    takeText,
  )
where

--

--

import Control.Monad.Error.Class (MonadError)
import Data.ByteString.Base16.Lazy qualified as B16
import Data.ByteString.Lazy qualified as BL
import Data.Map qualified as Map
import Data.Set qualified
import Data.Text qualified as T
import Data.Time
import Data.UUID qualified as UUID
import Free.AlaCarte
import NeatInterpolation hiding (text)
import Optics hiding (uncons)
import Relude
import Text.Blaze.Html as BlazeHtml
import WikiMusic.Model.Other
import WikiMusic.SSR.Language
import WikiMusic.SSR.Model.Api
import WikiMusic.SSR.Model.Config
import WikiMusic.SSR.Model.Env
import WikiMusic.SSR.View.Css

--

maybeDecodeUtf8 :: ByteString -> Either UnicodeException Text
maybeDecodeUtf8 :: ByteString -> Either UnicodeException Text
maybeDecodeUtf8 = ByteString -> Either UnicodeException Text
decodeUtf8'

textToAttrValue :: Text -> BlazeHtml.AttributeValue
textToAttrValue :: Text -> AttributeValue
textToAttrValue = String -> AttributeValue
forall a. IsString a => String -> a
fromString (String -> AttributeValue)
-> (Text -> String) -> Text -> AttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> String
T.unpack

maybeDecodeBase16 :: Text -> Either String BL.ByteString
maybeDecodeBase16 :: Text -> Either String ByteString
maybeDecodeBase16 = ByteString -> Either String ByteString
B16.decode (ByteString -> Either String ByteString)
-> (Text -> ByteString) -> Text -> Either String ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ByteString
forall a. IsString a => String -> a
fromString (String -> ByteString) -> (Text -> String) -> Text -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> String
T.unpack

uuidToText :: UUID.UUID -> Text
uuidToText :: UUID -> Text
uuidToText = UUID -> Text
UUID.toText

intToText :: Int -> Text
intToText :: Int -> Text
intToText = String -> Text
T.pack (String -> Text) -> (Int -> String) -> Int -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String
forall b a. (Show a, IsString b) => a -> b
show

unpackText :: Text -> String
unpackText :: Text -> String
unpackText = Text -> String
T.unpack

packText :: String -> Text
packText :: String -> Text
packText = String -> Text
T.pack

filterText :: (Char -> Bool) -> Text -> Text
filterText :: (Char -> Bool) -> Text -> Text
filterText = (Char -> Bool) -> Text -> Text
T.filter

replaceText :: Text -> Text -> Text -> Text
replaceText :: Text -> Text -> Text -> Text
replaceText = HasCallStack => Text -> Text -> Text -> Text
Text -> Text -> Text -> Text
T.replace

mapElems :: Map k a -> [a]
mapElems :: forall k a. Map k a -> [a]
mapElems = Map k a -> [a]
forall k a. Map k a -> [a]
Map.elems

mapFromList :: (Ord a) => [(a, b)] -> Map a b
mapFromList :: forall a b. Ord a => [(a, b)] -> Map a b
mapFromList = [(a, b)] -> Map a b
forall a b. Ord a => [(a, b)] -> Map a b
Map.fromList

emptyMap :: Map k a
emptyMap :: forall k a. Map k a
emptyMap = Map k a
forall k a. Map k a
Map.empty

mapFilter :: (a -> Bool) -> Map k a -> Map k a
mapFilter :: forall a k. (a -> Bool) -> Map k a -> Map k a
mapFilter = (a -> Bool) -> Map k a -> Map k a
forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter

setUnion :: (Ord a) => Set a -> Set a -> Set a
setUnion :: forall a. Ord a => Set a -> Set a -> Set a
setUnion Set a
a Set a
b = Set a
a Set a -> Set a -> Set a
forall a. Ord a => Set a -> Set a -> Set a
`Data.Set.union` Set a
b

takeText :: Int -> Text -> Text
takeText :: Int -> Text -> Text
takeText = Int -> Text -> Text
T.take