packages feed

colonnade 1.1.0 → 1.1.1

raw patch · 4 files changed

+22/−11 lines, 4 filesdep +semigroupsPVP ok

version bump matches the API change (PVP)

Dependencies added: semigroups

API changes (from Hackage documentation)

+ Colonnade: mapHeadedness :: (forall x. h x -> h' x) -> Colonnade h a c -> Colonnade h' a c
+ Colonnade: toHeadless :: Colonnade h a c -> Colonnade Headless a c

Files

colonnade.cabal view
@@ -1,5 +1,5 @@ name:                colonnade-version:             1.1.0+version:             1.1.1 synopsis:            Generic types and functions for columnar encoding and decoding description:   The `colonnade` package provides a way to to talk about@@ -39,6 +39,7 @@     , text >= 1.0 && < 1.3     , bytestring >= 0.10 && < 0.11     , profunctors >= 4.0 && < 5.3+    , semigroups >= 0.17 && < 0.19   default-language:    Haskell2010   ghc-options: -Wall 
src/Colonnade.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-}+{-# LANGUAGE RankNTypes #-} -{-# OPTIONS_GHC -Wall -fno-warn-unused-imports -fno-warn-unticked-promoted-constructors -Werror #-}+{-# OPTIONS_GHC -Wall -fno-warn-unused-imports -fno-warn-unticked-promoted-constructors #-}  -- | Build backend-agnostic columnar encodings that can be  --   used to visualize tabular data.@@ -16,12 +17,16 @@   , headless   , singleton     -- * Transform-  , mapHeaderContent+    -- ** Body   , fromMaybe   , columns   , bool   , replaceWhen   , modifyWhen+    -- ** Header+  , mapHeaderContent+  , mapHeadedness+  , toHeadless     -- * Cornice     -- ** Types   , Cornice@@ -118,6 +123,16 @@ mapHeaderContent f (E.Colonnade v) =    E.Colonnade (Vector.map (\(E.OneColonnade h e) -> E.OneColonnade (fmap f h) e) v) +-- | Map over the header type of a 'Colonnade'.+mapHeadedness :: (forall x. h x -> h' x) -> Colonnade h a c -> Colonnade h' a c+mapHeadedness f (E.Colonnade v) =+  E.Colonnade (Vector.map (\(E.OneColonnade h e) -> E.OneColonnade (f h) e) v)++-- | Remove the heading from a 'Colonnade'.+toHeadless :: Colonnade h a c -> Colonnade Headless a c+toHeadless = mapHeadedness (const Headless)+  + -- | Lift a column over a 'Maybe'. For example, if some people --   have houses and some do not, the data that pairs them together --   could be represented as:@@ -216,12 +231,7 @@   -> (a -> Bool) -- ^ Row predicate   -> Colonnade f a c -- ^ Original 'Colonnade'   -> Colonnade f a c-replaceWhen newContent p (E.Colonnade v) = E.Colonnade-  ( Vector.map-    (\(E.OneColonnade h encode) -> E.OneColonnade h $ \a ->-      if p a then newContent else encode a-    ) v-  )+replaceWhen = modifyWhen . const  -- | Augment a 'Colonnade' with a header spans over all of the --   existing headers. This is best demonstrated by example. 
src/Colonnade/Encode.hs view
@@ -8,7 +8,7 @@ {-# LANGUAGE ScopedTypeVariables #-}  {-# OPTIONS_HADDOCK not-home #-}-{-# OPTIONS_GHC -Wall -fno-warn-unused-imports -fno-warn-unticked-promoted-constructors -Werror #-}+{-# OPTIONS_GHC -Wall -fno-warn-unused-imports -fno-warn-unticked-promoted-constructors #-}  -- | Most users of this library do not need this module. The functions --   here are used to build functions that apply a 'Colonnade'
test/Main.hs view
@@ -2,5 +2,5 @@  main :: IO () main = doctest-  [ "src/Colonnade.hs"+  [ "src"   ]