From 3ae2f973d4168b2511686fd28892b719416ba7af Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Tue, 5 Jul 2016 11:32:01 -0400 Subject: [PATCH] remove trailing white space --- colonnade/src/Colonnade/Decoding.hs | 4 ++-- colonnade/src/Colonnade/Encoding.hs | 22 ++++++++--------- colonnade/src/Colonnade/Types.hs | 2 +- .../src/Reflex/Dom/Colonnade.hs | 2 +- siphon/src/Siphon.hs | 2 +- siphon/src/Siphon/Content.hs | 2 +- siphon/src/Siphon/Decoding.hs | 24 +++++++++---------- siphon/src/Siphon/Encoding.hs | 16 ++++++------- siphon/src/Siphon/Types.hs | 2 +- 9 files changed, 38 insertions(+), 38 deletions(-) diff --git a/colonnade/src/Colonnade/Decoding.hs b/colonnade/src/Colonnade/Decoding.hs index 06b3ded..973b516 100644 --- a/colonnade/src/Colonnade/Decoding.hs +++ b/colonnade/src/Colonnade/Decoding.hs @@ -62,7 +62,7 @@ uncheckedRun dc v = getEitherWrap (go dc) rcurrent = mapLeft (DecodingCellErrors . Vector.singleton . DecodingCellError content ixed) (decode content) in rnext <*> (EitherWrap rcurrent) -headlessToIndexed :: forall c a. +headlessToIndexed :: forall c a. Decoding Headless c a -> Decoding (Indexed Headless) c a headlessToIndexed = go 0 where go :: forall b. Int -> Decoding Headless c b -> Decoding (Indexed Headless) c b @@ -71,7 +71,7 @@ headlessToIndexed = go 0 where DecodingAp (Indexed ix Headless) decode (go (ix + 1) apNext) length :: forall f c a. Decoding f c a -> Int -length = go 0 where +length = go 0 where go :: forall b. Int -> Decoding f c b -> Int go !a (DecodingPure _) = a go !a (DecodingAp _ _ apNext) = go (a + 1) apNext diff --git a/colonnade/src/Colonnade/Encoding.hs b/colonnade/src/Colonnade/Encoding.hs index d5aa667..ccee20f 100644 --- a/colonnade/src/Colonnade/Encoding.hs +++ b/colonnade/src/Colonnade/Encoding.hs @@ -21,26 +21,26 @@ headed h f = Encoding (Vector.singleton (OneEncoding (Headed h) f)) -- instead. It may allow more things to get inlined -- in to a loop. runRow :: (c1 -> c2) -> Encoding f c1 a -> a -> Vector c2 -runRow g (Encoding v) a = flip Vector.map v $ +runRow g (Encoding v) a = flip Vector.map v $ \(OneEncoding _ encode) -> g (encode a) -runRowMonadic :: Monad m - => Encoding f content a - -> (content -> m ()) - -> a +runRowMonadic :: Monad m + => Encoding f content a + -> (content -> m ()) + -> a -> m () -runRowMonadic (Encoding v) g a = Vector.forM_ v $ \e -> +runRowMonadic (Encoding v) g a = Vector.forM_ v $ \e -> g (oneEncodingEncode e a) runHeader :: (c1 -> c2) -> Encoding Headed c1 a -> Vector c2 -runHeader g (Encoding v) = +runHeader g (Encoding v) = Vector.map (g . getHeaded . oneEncodingHead) v -runHeaderMonadic :: Monad m - => Encoding Headed content a - -> (content -> m ()) +runHeaderMonadic :: Monad m + => Encoding Headed content a + -> (content -> m ()) -> m () -runHeaderMonadic (Encoding v) g = +runHeaderMonadic (Encoding v) g = Vector.mapM_ (g . getHeaded . oneEncodingHead) v diff --git a/colonnade/src/Colonnade/Types.hs b/colonnade/src/Colonnade/Types.hs index ee0b477..99443e4 100644 --- a/colonnade/src/Colonnade/Types.hs +++ b/colonnade/src/Colonnade/Types.hs @@ -107,7 +107,7 @@ instance Contravariant (OneEncoding f content) where contramap f (OneEncoding h e) = OneEncoding h (e . f) newtype Encoding f content a = Encoding - { getEncoding :: Vector (OneEncoding f content a) + { getEncoding :: Vector (OneEncoding f content a) } deriving (Monoid) instance Contravariant (Encoding f content) where diff --git a/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs b/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs index 397e658..2b8f76a 100644 --- a/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs +++ b/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs @@ -33,7 +33,7 @@ elFromCell :: MonadWidget t m => String -> Cell m -> m () elFromCell name (Cell attrs contents) = elAttr name attrs contents theadBuild :: MonadWidget t m => Encoding Headed (Cell m) a -> m () -theadBuild encoding = el "thead" . el "tr" +theadBuild encoding = el "thead" . el "tr" $ Encoding.runHeaderMonadic encoding (elFromCell "th") dynamic :: (MonadWidget t m, Foldable f) diff --git a/siphon/src/Siphon.hs b/siphon/src/Siphon.hs index 945ce35..5c6b00a 100644 --- a/siphon/src/Siphon.hs +++ b/siphon/src/Siphon.hs @@ -4,7 +4,7 @@ module Siphon where -- encode -- decode :: Pipe (Vector c) a m x --- encode :: +-- encode :: -- row :: Vector (Escaped Text) -> Text -- row = Vector. diff --git a/siphon/src/Siphon/Content.hs b/siphon/src/Siphon/Content.hs index 03f21bf..26e1f79 100644 --- a/siphon/src/Siphon/Content.hs +++ b/siphon/src/Siphon/Content.hs @@ -1,4 +1,4 @@ -module Siphon.Content +module Siphon.Content ( byteStringChar8 ) where diff --git a/siphon/src/Siphon/Decoding.hs b/siphon/src/Siphon/Decoding.hs index 0f06f2e..bc6b938 100644 --- a/siphon/src/Siphon/Decoding.hs +++ b/siphon/src/Siphon/Decoding.hs @@ -17,7 +17,7 @@ import qualified Data.ByteString.Char8 as ByteString import qualified Data.Attoparsec.Types as Atto -- unrow :: c1 -> (Vector c2,c1) --- +-- -- row :: _ -- -> Decoding (Indexed f) c a -- -> Vector c @@ -27,7 +27,7 @@ import qualified Data.Attoparsec.Types as Atto -- Monad m -- => Decoding (Indexed f) c a -- -> Pipe (Vector c) a m () --- decodeVectorPipe +-- decodeVectorPipe mkParseError :: Int -> [String] -> String -> DecodingRowError f content mkParseError i ctxs msg = id @@ -55,7 +55,7 @@ indexedPipe :: Monad m -> Decoding (Indexed Headless) c a -> Pipe c a m (DecodingRowError Headless c) indexedPipe sd decoding = do - (firstRow, mleftovers) <- consumeGeneral sd mkParseError + (firstRow, mleftovers) <- consumeGeneral sd mkParseError let req = Decoding.maxIndex decoding vlen = Vector.length firstRow if vlen < req @@ -72,28 +72,28 @@ headedPipe :: (Monad m, Eq c) -> Decoding Headed c a -> Pipe c a m (DecodingRowError Headed c) headedPipe sd decoding = do - (headers, mleftovers) <- consumeGeneral sd mkParseError + (headers, mleftovers) <- consumeGeneral sd mkParseError case Decoding.headedToIndexed headers decoding of Left headingErrs -> return (DecodingRowError 0 (RowErrorHeading headingErrs)) - Right indexedDecoding -> + Right indexedDecoding -> let requiredLength = Vector.length headers in uncheckedPipe requiredLength 1 sd indexedDecoding mleftovers - + uncheckedPipe :: Monad m => Int -- ^ expected length of each row -> Int -- ^ index of first row, usually zero or one - -> Siphon c + -> Siphon c -> Decoding (Indexed f) c a -> Maybe c -> Pipe c a m (DecodingRowError f c) -uncheckedPipe requiredLength ix sd d mleftovers = +uncheckedPipe requiredLength ix sd d mleftovers = pipeGeneral ix sd mkParseError checkedRunWithRow mleftovers where - checkedRunWithRow rowIx v = + checkedRunWithRow rowIx v = let vlen = Vector.length v in if vlen /= requiredLength - then Left $ DecodingRowError rowIx + then Left $ DecodingRowError rowIx $ RowErrorSize requiredLength vlen else Decoding.uncheckedRunWithRow rowIx d v @@ -110,7 +110,7 @@ pipeGeneral :: Monad m -> (Int -> Vector c -> Either e a) -> Maybe c -- ^ leftovers that should be handled first -> Pipe c a m e -pipeGeneral initIx (Siphon _ _ parse isNull) wrapParseError decodeRow mleftovers = +pipeGeneral initIx (Siphon _ _ parse isNull) wrapParseError decodeRow mleftovers = case mleftovers of Nothing -> go1 initIx Just leftovers -> handleResult initIx (parse leftovers) @@ -138,6 +138,6 @@ awaitSkip :: Monad m awaitSkip f = go where go = do a <- await - if f a then go else return a + if f a then go else return a diff --git a/siphon/src/Siphon/Encoding.hs b/siphon/src/Siphon/Encoding.hs index d02d6c6..a55fa99 100644 --- a/siphon/src/Siphon/Encoding.hs +++ b/siphon/src/Siphon/Encoding.hs @@ -7,27 +7,27 @@ import qualified Pipes.Prelude as Pipes import qualified Colonnade.Encoding as Encoding row :: Siphon c - -> Encoding f c a - -> a + -> Encoding f c a + -> a -> c row (Siphon escape intercalate _ _) e = intercalate . Encoding.runRow escape e header :: Siphon c - -> Encoding Headed c a + -> Encoding Headed c a -> c header (Siphon escape intercalate _ _) e = intercalate (Encoding.runHeader escape e) -pipe :: Monad m +pipe :: Monad m => Siphon c - -> Encoding f c a + -> Encoding f c a -> Pipe a c m x pipe siphon encoding = Pipes.map (row siphon encoding) -headedPipe :: Monad m - => Siphon c - -> Encoding Headed c a +headedPipe :: Monad m + => Siphon c + -> Encoding Headed c a -> Pipe a c m x headedPipe siphon encoding = do yield (header siphon encoding) diff --git a/siphon/src/Siphon/Types.hs b/siphon/src/Siphon/Types.hs index 110beeb..6a6b0e3 100644 --- a/siphon/src/Siphon/Types.hs +++ b/siphon/src/Siphon/Types.hs @@ -31,6 +31,6 @@ data SiphonDecoding c1 c2 = SiphonDecoding -- } -- data SiphonDecodingError --- { clarify +-- { clarify -- }