Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use text instead of foundation #440

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions hoogle.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ library
directory,
extra >= 1.6.6,
filepath,
foundation >= 0.0.13,
old-locale,
hashable,
haskell-src-exts >= 1.22 && < 1.24,
Expand All @@ -74,7 +73,7 @@ library
storable-tuple,
tar,
template-haskell,
text,
text >= 2,
time >= 1.5,
transformers,
uniplate,
Expand Down
17 changes: 8 additions & 9 deletions src/General/Str.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ module General.Str(
BStr0, bstr0Join, bstr0Split
) where

import qualified Foundation as Fdn
import qualified Foundation.Collection as Fdn
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.UTF8 as US
import qualified Data.ByteString.Lazy.Char8 as LBS
import qualified Data.ByteString.Lazy.UTF8 as LUS
import qualified Data.Text as T
import Control.DeepSeq
import Data.Char
import Data.Data
Expand All @@ -23,8 +22,8 @@ import Data.String
import Prelude


newtype Str = Str {fromStr :: Fdn.String}
deriving (Data,Typeable,Eq,Ord,Semigroup,Monoid)
newtype Str = Str { fromStr :: T.Text }
deriving (Data, Typeable, Eq, Ord, Semigroup, Monoid)

instance Show Str where show = strUnpack
instance NFData Str where rnf x = x `seq` ()
Expand All @@ -36,19 +35,19 @@ type LBStr = LBS.ByteString


strPack :: String -> Str
strPack = Str . fromString
strPack = Str . T.pack

strUnpack :: Str -> String
strUnpack = Fdn.toList . fromStr
strUnpack = T.unpack . fromStr

strCons :: Char -> Str -> Str
strCons c = Str . Fdn.cons c . fromStr
strCons c = Str . T.cons c . fromStr

strCopy :: Str -> Str
strCopy = Str . Fdn.copy . fromStr
strCopy = Str . T.copy . fromStr

strNull :: Str -> Bool
strNull = Fdn.null . fromStr
strNull = T.null . fromStr

bstrPack :: String -> BStr
bstrPack = US.fromString
Expand Down
Loading