on master help sign in
Move some types into an internal module that is shared.

--HG-- extra : convert_revision : daefe22108b3ab2104dc68dc94d2bdbede142fb2

commit75c299b36c46574a684ab7040d11fc5e5a388b57 authorBryan O'Sullivan <bos@serpentine.com> dateSat 23 May 2009, 01:30 (17 years ago) parent75e89c0
2 files changed+14−8
Data/Text/Encoding/Fusion/Common.hs+1−7 Data/Text/Fusion/Internal.hs+13−1
Data/Text/Encoding/Fusion/Common.hs+1−7
@@ -30,16 +30,10 @@ module Data.Text.Encoding.Fusion.Common
3030import Data.Bits (shiftL, shiftR, (.&.))
3131import Data.Char (ord)
3232import Data.Text.Fusion (Step(..), Stream(..))
33−import Data.Text.Fusion.Internal (M(..))
33+import Data.Text.Fusion.Internal (M(..), S(..))
3434import Data.Word (Word8)
3535import qualified Data.Text.Encoding.Utf8 as U8
3636
37−type M8 = M Word8
38−
39−-- Restreaming state.
40−data S s = S {-# UNPACK #-} !s
41− {-# UNPACK #-} !M8 {-# UNPACK #-} !M8 {-# UNPACK #-} !M8
42−
4337-- | /O(n)/ Convert a Stream Char into a UTF-8 encoded Stream Word8.
4438restreamUtf8 :: Stream Char -> Stream Word8
4539restreamUtf8 (Stream next0 s0 len) =
Data/Text/Fusion/Internal.hs+13−1
@@ -16,24 +16,36 @@
1616module Data.Text.Fusion.Internal
1717 (
1818 M(..)
19+ , M8
1920 , PairS(..)
20− , Switch(..)
21+ , S(..)
2122 , Step(..)
2223 , Stream(..)
24+ , Switch(..)
2325 , empty
2426 ) where
2527
28+import Data.Word (Word8)
29+
2630-- | Specialised, strict Maybe-like type.
2731data M a = N
2832 | J {-# UNPACK #-} !a
2933 deriving (Eq, Ord, Show)
3034
35+type M8 = M Word8
36+
37+-- Restreaming state.
38+data S s = S {-# UNPACK #-} !s
39+ {-# UNPACK #-} !M8 {-# UNPACK #-} !M8 {-# UNPACK #-} !M8
40+ deriving (Eq, Ord, Show)
41+
3142infixl 2 :!:
3243data PairS a b = !a :!: !b
3344 deriving (Eq, Ord, Read, Show)
3445
3546-- | Allow a function over a stream to switch between two states.
3647data Switch = S1 | S2
48+ deriving (Eq, Ord, Show)
3749
3850data Step s a = Done
3951 | Skip !s