packages feed

bamboo-2009.5.23: src/Bamboo/Helper/ByteString.hs

{-# LANGUAGE NoMonomorphismRestriction#-}
{-# LANGUAGE NoImplicitPrelude #-}

module Bamboo.Helper.ByteString where

import Data.Char (toLower)
import qualified Data.ByteString.Lazy.Char8 as L
import qualified Data.ByteString.UTF8 as U
import qualified Data.ByteString.Char8 as S
import Bamboo.Helper.PreludeEnv

l2s = L.toChunks > S.concat
s2l = return > L.fromChunks

lower = L.map toLower
bs2u = l2s > U.toString
u2bs = U.fromString > s2l

isInfixOf a b = S.isInfixOf (a.l2s) (b.l2s)

read_bytestring = u2b > L.readFile