Commits

Bryan O'Sullivan  committed cc6c3d2

Move some types into an internal module that is shared.

  • Participants
  • Parent commits de2df73

Comments (0)

Files changed (2)

File Data/Text/Encoding/Fusion/Common.hs

 import Data.Bits (shiftL, shiftR, (.&.))
 import Data.Char (ord)
 import Data.Text.Fusion (Step(..), Stream(..))
-import Data.Text.Fusion.Internal (M(..))
+import Data.Text.Fusion.Internal (M(..), S(..))
 import Data.Word (Word8)
 import qualified Data.Text.Encoding.Utf8 as U8
 
-type M8 = M Word8
-
--- Restreaming state.
-data S s = S {-# UNPACK #-} !s
-    {-# UNPACK #-} !M8 {-# UNPACK #-} !M8 {-# UNPACK #-} !M8
-
 -- | /O(n)/ Convert a Stream Char into a UTF-8 encoded Stream Word8.
 restreamUtf8 :: Stream Char -> Stream Word8
 restreamUtf8 (Stream next0 s0 len) =

File Data/Text/Fusion/Internal.hs

 module Data.Text.Fusion.Internal
     (
       M(..)
+    , M8
     , PairS(..)
-    , Switch(..)
+    , S(..)
     , Step(..)
     , Stream(..)
+    , Switch(..)
     , empty
     ) where
 
+import Data.Word (Word8)
+
 -- | Specialised, strict Maybe-like type.
 data M a = N
          | J {-# UNPACK #-} !a
            deriving (Eq, Ord, Show)
 
+type M8 = M Word8
+
+-- Restreaming state.
+data S s = S {-# UNPACK #-} !s
+    {-# UNPACK #-} !M8 {-# UNPACK #-} !M8 {-# UNPACK #-} !M8
+           deriving (Eq, Ord, Show)
+
 infixl 2 :!:
 data PairS a b = !a :!: !b
                deriving (Eq, Ord, Read, Show)
 
 -- | Allow a function over a stream to switch between two states.
 data Switch = S1 | S2
+            deriving (Eq, Ord, Show)
 
 data Step s a = Done
               | Skip !s