packages feed

linear 1.1.2 → 1.1.4

raw patch · 20 files changed

+381/−49 lines, 20 filesdep +base-orphans

Dependencies added: base-orphans

Files

CHANGELOG.markdown view
@@ -1,3 +1,7 @@+1.1.4+-----+* Marked modules `Trustworthy` as necessary.+ 1.1.2 ----- * Dependency bump for `reflection` compatibility
linear.cabal view
@@ -1,6 +1,6 @@ name:          linear category:      Math, Algebra-version:       1.1.2+version:       1.1.4 license:       BSD3 cabal-version: >= 1.8 license-file:  LICENSE@@ -55,8 +55,10 @@     Linear.Metric     Linear.Plucker     Linear.Quaternion+    Linear.Trace     Linear.V     Linear.V0+    Linear.V1     Linear.V2     Linear.V3     Linear.V4
src/Linear.hs view
@@ -1,6 +1,5 @@ ----------------------------------------------------------------------------- -- |--- Module      :  Linear -- Copyright   :  (C) 2012-2013 Edward Kmett, -- License     :  BSD-style (see the file LICENSE) --@@ -19,7 +18,9 @@   , module Linear.Metric   , module Linear.Plucker   , module Linear.Quaternion+  , module Linear.Trace   , module Linear.V0+  , module Linear.V1   , module Linear.V2   , module Linear.V3   , module Linear.V4@@ -34,7 +35,9 @@ import Linear.Metric import Linear.Plucker import Linear.Quaternion+import Linear.Trace import Linear.V0+import Linear.V1 import Linear.V2 import Linear.V3 import Linear.V4
src/Linear/Affine.hs view
@@ -2,9 +2,11 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TypeFamilies #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |--- Module      :  Linear.Vector -- License     :  BSD-style (see the file LICENSE) -- Maintainer  :  Edward Kmett <ekmett@gmail.com> -- Stability   :  provisional@@ -34,6 +36,7 @@ import Linear.Quaternion import Linear.V import Linear.V0+import Linear.V1 import Linear.V2 import Linear.V3 import Linear.V4@@ -47,11 +50,11 @@ -- > (a .-. b) ^+^ v  =  (a .+^ v) .-. q@ class Additive (Diff p) => Affine p where   type Diff p :: * -> *-  +   infixl 6 .-.   -- | Get the difference between two points as a vector offset.   (.-.) :: Num a => p a -> p a -> Diff p a-  +   infixl 6 .+^   -- | Add a vector offset to a point.   (.+^) :: Num a => p a -> Diff p a -> p a@@ -83,6 +86,7 @@ ADDITIVE(Identity) ADDITIVE(Vector) ADDITIVE(V0)+ADDITIVE(V1) ADDITIVE(V2) ADDITIVE(V3) ADDITIVE(V4)@@ -97,7 +101,7 @@ -- type level newtype Point f a = P (f a)   deriving ( Eq, Ord, Show, Read, Monad, Functor, Applicative, Foldable-           , Traversable, Apply, Bind, Additive, Metric, Core, R2, R3, R4+           , Traversable, Apply, Bind, Additive, Metric, Core, R1, R2, R3, R4            , Fractional , Num, Ix, Storable, Epsilon            ) 
src/Linear/Conjugate.hs view
@@ -1,6 +1,6 @@+{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- |--- Module      :  Linear.Conjugate -- Copyright   :  (C) 2012-2013 Edward Kmett, -- License     :  BSD-style (see the file LICENSE) --@@ -46,6 +46,7 @@ instance Conjugate Float instance Conjugate CFloat instance Conjugate CDouble+ instance (Conjugate a, RealFloat a) => Conjugate (Complex a) where   {-# SPECIALIZE instance Conjugate (Complex Float) #-}   {-# SPECIALIZE instance Conjugate (Complex Double) #-}
src/Linear/Core.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE RankNTypes #-} ----------------------------------------------------------------------------- -- |--- Module      :  Linear.Core -- Copyright   :  (C) 2012-2013 Edward Kmett, -- License     :  BSD-style (see the file LICENSE) --
src/Linear/Epsilon.hs view
@@ -1,6 +1,5 @@ ----------------------------------------------------------------------------- -- |--- Module      :  Linear.Epsilon -- Copyright   :  (C) 2012 Edward Kmett -- License     :  BSD-style (see the file LICENSE) -- Maintainer  :  Edward Kmett <ekmett@gmail.com>
src/Linear/Instances.hs view
@@ -1,7 +1,10 @@ {-# OPTIONS_GHC -fno-warn-orphans #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |--- Module      :  Linear.Instances -- Copyright   :  (C) 2012 Edward Kmett -- License     :  BSD-style (see the file LICENSE) -- Maintainer  :  Edward Kmett <ekmett@gmail.com>
src/Linear/Matrix.hs view
@@ -1,6 +1,9 @@------------------------------------------------------------------------------+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif+--------------------------------------------------------------------------- -- |--- Module      :  Linear.Matrix -- Copyright   :  (C) 2012-2013 Edward Kmett, -- License     :  BSD-style (see the file LICENSE) --@@ -9,14 +12,14 @@ -- Portability :  non-portable -- -- Simple matrix operation for low-dimensional primitives.-----------------------------------------------------------------------------+--------------------------------------------------------------------------- module Linear.Matrix   ( (!*!), (!+!), (!-!), (!*) , (*!), (!!*), (*!!)   , adjoint   , M22, M33, M44, M43, m33_to_m44, m43_to_m44   , det22, det33, inv22, inv33   , eye2, eye3, eye4-  , trace+  , Trace(..)   , translation   , fromQuaternion   , mkTransformation@@ -24,7 +27,6 @@   ) where  import Control.Applicative-import Control.Monad (join) import Data.Distributive import Data.Foldable as Foldable import Linear.Epsilon@@ -35,6 +37,7 @@ import Linear.V4 import Linear.Vector import Linear.Conjugate+import Linear.Trace  -- $setup -- >>> import Data.Complex@@ -109,14 +112,6 @@ adjoint :: (Functor m, Distributive n, Conjugate a) => m (n a) -> n (m a) adjoint = collect (fmap conjugate) {-# INLINE adjoint #-}---- | Compute the trace of a matrix------ >>> trace (V2 (V2 a b) (V2 c d))--- a + d-trace :: (Monad f, Foldable f, Num a) => f (f a) -> a-trace m = Foldable.sum (join m)-{-# INLINE trace #-}  -- * Matrices --
src/Linear/Metric.hs view
@@ -1,8 +1,10 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DefaultSignatures #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |--- Module      :  Linear.Metric -- Copyright   :  (C) 2012-2013 Edward Kmett, -- License     :  BSD-style (see the file LICENSE) --
src/Linear/Plucker.hs view
@@ -1,7 +1,10 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |--- Module      :  Linear.Plucker -- Copyright   :  (C) 2012-2013 Edward Kmett, -- License     :  BSD-style (see the file LICENSE) --
src/Linear/Quaternion.hs view
@@ -1,7 +1,10 @@ {-# LANGUAGE DeriveDataTypeable, PatternGuards, ScopedTypeVariables #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |--- Module      :  Linear.Quaternion -- Copyright   :  (C) 2012-2013 Edward Kmett, -- License     :  BSD-style (see the file LICENSE) --
+ src/Linear/Trace.hs view
@@ -0,0 +1,114 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE DefaultSignatures #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif+---------------------------------------------------------------------------+-- |+-- Copyright   :  (C) 2012-2013 Edward Kmett,+-- License     :  BSD-style (see the file LICENSE)+--+-- Maintainer  :  Edward Kmett <ekmett@gmail.com>+-- Stability   :  experimental+-- Portability :  non-portable+--+-- Simple matrix operation for low-dimensional primitives.+---------------------------------------------------------------------------+module Linear.Trace+  ( Trace(..)+  ) where++import Control.Monad as Monad+-- import Linear.V1+import Linear.V0+import Linear.V2+import Linear.V3+import Linear.V4+import Linear.Plucker+import Linear.Quaternion+import Linear.V+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ > 704+import Data.Complex+#endif+import Data.Distributive+import Data.Foldable as Foldable+import Data.Functor.Bind as Bind+import Data.Functor.Compose+import Data.Functor.Product+import Data.Hashable+import Data.HashMap.Lazy+import Data.IntMap+import Data.Map++-- $setup+-- >>> import Data.Complex+-- >>> import Data.IntMap+-- >>> import Debug.SimpleReflect.Vars++class Functor m => Trace m where+  -- | Compute the trace of a matrix+  --+  -- >>> trace (V2 (V2 a b) (V2 c d))+  -- a + d+  trace :: Num a => m (m a) -> a+#ifndef HLINT+  default trace :: (Foldable m, Num a) => m (m a) -> a+  trace = Foldable.sum . diagonal+  {-# INLINE trace #-}+#endif++  -- | Compute the diagonal of a matrix+  --+  -- >>> diagonal (V2 (V2 a b) (V2 c d))+  -- V2 a d+  diagonal :: m (m a) -> m a+#ifndef HLINT+  default diagonal :: Monad m => m (m a) -> m a+  diagonal = Monad.join+  {-# INLINE diagonal #-}+#endif++instance Trace IntMap where+  diagonal = Bind.join+  {-# INLINE diagonal #-}++instance Ord k => Trace (Map k) where+  diagonal = Bind.join+  {-# INLINE diagonal #-}++instance (Eq k, Hashable k) => Trace (HashMap k) where+  diagonal = Bind.join+  {-# INLINE diagonal #-}++instance Dim n => Trace (V n)+instance Trace V0+instance Trace V2+instance Trace V3+instance Trace V4+instance Trace Plucker+instance Trace Quaternion++#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ > 704+instance Trace Complex where+  trace ((a :+ _) :+ (_ :+ b)) = a + b+  {-# INLINE trace #-}+  diagonal ((a :+ _) :+ (_ :+ b)) = a :+ b+  {-# INLINE diagonal #-}+#endif++instance (Trace f, Trace g) => Trace (Product f g) where+  trace (Pair xx yy) = trace (pfst <$> xx) + trace (psnd <$> yy) where+    pfst (Pair x _) = x+    psnd (Pair _ y) = y+  {-# INLINE trace #-}+  diagonal (Pair xx yy) = diagonal (pfst <$> xx) `Pair` diagonal (psnd <$> yy) where+    pfst (Pair x _) = x+    psnd (Pair _ y) = y+  {-# INLINE diagonal #-}++instance (Distributive g, Trace g, Trace f) => Trace (Compose g f) where+  trace = trace . fmap (fmap trace . distribute) . getCompose . fmap getCompose+  {-# INLINE trace #-}+  diagonal = Compose . fmap diagonal . diagonal . fmap distribute . getCompose . fmap getCompose+  {-# INLINE diagonal #-}
src/Linear/V.hs view
@@ -9,6 +9,20 @@ {-# LANGUAGE PolyKinds #-} #define USE_TYPE_LITS 1 #endif+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif+-----------------------------------------------------------------------------+-- |+-- Copyright   :  (C) 2012-2013 Edward Kmett,+-- License     :  BSD-style (see the file LICENSE)+--+-- Maintainer  :  Edward Kmett <ekmett@gmail.com>+-- Stability   :  experimental+-- Portability :  non-portable+--+-- n-D Vectors+----------------------------------------------------------------------------  module Linear.V   ( V(toVector)@@ -33,7 +47,9 @@ #ifdef USE_TYPE_LITS import GHC.TypeLits #endif+#if !(MIN_VERSION_reflection(1,3,0)) import Language.Haskell.TH+#endif import Linear.Core import Linear.Epsilon import Linear.Metric
src/Linear/V0.hs view
@@ -2,9 +2,12 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |--- Module      :  Linear.V0 -- Copyright   :  (C) 2012-2013 Edward Kmett, -- License     :  BSD-style (see the file LICENSE) --
+ src/Linear/V1.hs view
@@ -0,0 +1,174 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveFoldable #-}+{-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE ScopedTypeVariables #-}+-- {-# OPTIONS_GHC -fno-warn-name-shadowing #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif+-----------------------------------------------------------------------------+-- |+-- Copyright   :  (C) 2012-2013 Edward Kmett,+-- License     :  BSD-style (see the file LICENSE)+--+-- Maintainer  :  Edward Kmett <ekmett@gmail.com>+-- Stability   :  experimental+-- Portability :  non-portable+--+-- 1-D Vectors+----------------------------------------------------------------------------+module Linear.V1+  ( V1(..)+  , R1(..)+  ) where++import Control.Applicative+import Data.Data+import Data.Distributive+import Data.Foldable+import Data.Functor.Identity (Identity(..))+import Data.Traversable+import Data.Semigroup.Foldable+import Data.Semigroup.Traversable+import Data.Functor.Bind+import Foreign.Storable (Storable)+import GHC.Arr (Ix(..))+import Linear.Core+import Linear.Metric+import Linear.Epsilon+import Linear.Vector+import Prelude hiding (sum)++-- $setup+-- >>> import Control.Lens++-- | A 1-dimensional vector+--+-- >>> pure 1 :: V1 Int+-- V1 1+--+-- >>> V1 2 + V1 3+-- V1 5+--+-- >>> V1 2 * V1 3+-- V1 6+--+-- >>> sum (V1 2)+-- 2++--data V2 a = V2 !a !a deriving (Eq,Ord,Show,Read,Data,Typeable)+newtype V1 a = V1 a+  deriving (Eq,Ord,Show,Read,Data,Typeable,+            Functor,Foldable,Traversable,+            Epsilon,Storable)++instance Foldable1 V1 where+  foldMap1 f (V1 a) = f a+  {-# INLINE foldMap1 #-}++instance Traversable1 V1 where+  traverse1 f (V1 a) = V1 <$> f a+  {-# INLINE traverse1 #-}++instance Apply V1 where+  V1 f <.> V1 x = V1 (f x)+  {-@ INLINE (<.>) #-}++instance Applicative V1 where+  pure = V1+  {-# INLINE pure #-}+  V1 f <*> V1 x = V1 (f x)+  {-@ INLINE (<*>) #-}++instance Additive V1 where+  zero = pure 0+  {-# INLINE zero #-}+  liftU2 = liftA2+  {-# INLINE liftU2 #-}+  liftI2 = liftA2+  {-# INLINE liftI2 #-}++instance Bind V1 where+  V1 a >>- f = f a+  {-# INLINE (>>-) #-}++instance Monad V1 where+  return = V1+  {-# INLINE return #-}+  V1 a >>= f = f a+  {-# INLINE (>>=) #-}++instance Num a => Num (V1 a) where+  (+) = liftA2 (+)+  {-# INLINE (+) #-}+  (-) = liftA2 (-)+  {-# INLINE (-) #-}+  (*) = liftA2 (*)+  {-# INLINE (*) #-}+  negate = fmap negate+  {-# INLINE negate #-}+  abs = fmap abs+  {-# INLINE abs #-}+  signum = fmap signum+  {-# INLINE signum #-}+  fromInteger = pure . fromInteger+  {-# INLINE fromInteger #-}++instance Fractional a => Fractional (V1 a) where+  recip = fmap recip+  {-# INLINE recip #-}+  (/) = liftA2 (/)+  {-# INLINE (/) #-}+  fromRational = pure . fromRational+  {-# INLINE fromRational #-}++instance Metric V1 where+  dot (V1 a) (V1 b) = a * b+  {-# INLINE dot #-}++-- | A space that has at least 1 basis vector '_x'.+class R1 t where+  -- |+  -- >>> V1 2 ^._x+  -- 2+  --+  -- >>> V1 2 & _x .~ 3+  -- V1 3+  --+  -- @+  -- '_x' :: Lens' (t a) a+  -- @+  _x :: Functor f => (a -> f a) -> t a -> f (t a)++instance R1 V1 where+  _x f (V1 a) = V1 <$> f a+  {-# INLINE _x #-}++instance R1 Identity where+  _x f (Identity a) = Identity <$> f a+  {-# INLINE _x #-}++instance Core V1 where+  core f = V1 (f _x)+  {-# INLINE core #-}++instance Distributive V1 where+  distribute f = V1 (fmap (\(V1 x) -> x) f)+  {-# INLINE distribute #-}++instance Ix a => Ix (V1 a) where+  {-# SPECIALISE instance Ix (V1 Int) #-}++  range (V1 l1, V1 u1) =+    [ V1 i1 | i1 <- range (l1,u1) ]+  {-# INLINE range #-}++  unsafeIndex (V1 l1,V1 u1) (V1 i1) = unsafeIndex (l1,u1) i1+  {-# INLINE unsafeIndex #-}++  inRange (V1 l1,V1 u1) (V1 i1) = inRange (l1,u1) i1+  {-# INLINE inRange #-}
src/Linear/V2.hs view
@@ -2,9 +2,12 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ScopedTypeVariables #-} -- {-# OPTIONS_GHC -fno-warn-name-shadowing #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |--- Module      :  Linear.V2 -- Copyright   :  (C) 2012-2013 Edward Kmett, -- License     :  BSD-style (see the file LICENSE) --@@ -16,6 +19,7 @@ ---------------------------------------------------------------------------- module Linear.V2   ( V2(..)+  , R1(..)   , R2(..)   , perp   ) where@@ -36,6 +40,7 @@ import Linear.Metric import Linear.Epsilon import Linear.Vector+import Linear.V1 (R1(..)) import Prelude hiding (sum)  -- $setup@@ -140,21 +145,7 @@   {-# INLINE dot #-}  -- | A space that distinguishes 2 orthogonal basis vectors '_x' and '_y', but may have more.-class R2 t where-  -- |-  -- >>> V2 1 2 ^._x-  -- 1-  ---  -- >>> V2 1 2 & _x .~ 3-  -- V2 3 2-  ---  -- @-  -- '_x' :: Lens' (t a) a-  -- @-  _x :: Functor f => (a -> f a) -> t a -> f (t a)-  _x = _xy._x-  {-# INLINE _x #-}-+class R1 t => R2 t where   -- |   -- >>> V2 1 2 ^._y   -- 2@@ -175,9 +166,11 @@   -- @   _xy :: Functor f => (V2 a -> f (V2 a)) -> t a -> f (t a) -instance R2 V2 where+instance R1 V2 where   _x f (V2 a b) = (`V2` b) <$> f a   {-# INLINE _x #-}++instance R2 V2 where   _y f (V2 a b) = V2 a <$> f b   {-# INLINE _y #-}   _xy = id
src/Linear/V3.hs view
@@ -1,7 +1,10 @@ {-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |--- Module      :  Linear.V3 -- Copyright   :  (C) 2012-2013 Edward Kmett, -- License     :  BSD-style (see the file LICENSE) --@@ -14,6 +17,7 @@ module Linear.V3   ( V3(..)   , cross, triple+  , R1(..)   , R2(..)   , R3(..)   ) where@@ -142,9 +146,11 @@   -- @   _xyz :: Functor f => (V3 a -> f (V3 a)) -> t a -> f (t a) -instance R2 V3 where+instance R1 V3 where   _x f (V3 a b c) = (\a' -> V3 a' b c) <$> f a   {-# INLINE _x #-}++instance R2 V3 where   _y f (V3 a b c) = (\b' -> V3 a b' c) <$> f b   {-# INLINE _y #-}   _xy f (V3 a b c) = (\(V2 a' b') -> V3 a' b' c) <$> f (V2 a b)
src/Linear/V4.hs view
@@ -1,7 +1,10 @@ {-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |--- Module      :  Linear.V4 -- Copyright   :  (C) 2012-2013 Edward Kmett, -- License     :  BSD-style (see the file LICENSE) --@@ -14,6 +17,7 @@ module Linear.V4   ( V4(..)   , vector, point+  , R1(..)   , R2(..)   , R3(..)   , R4(..)@@ -149,9 +153,11 @@   -- @   _xyzw :: Functor f => (V4 a -> f (V4 a)) -> t a -> f (t a) -instance R2 V4 where+instance R1 V4 where   _x f (V4 a b c d) = (\a' -> V4 a' b c d) <$> f a   {-# INLINE _x #-}++instance R2 V4 where   _y f (V4 a b c d) = (\b' -> V4 a b' c d) <$> f b   {-# INLINE _y #-}   _xy f (V4 a b c d) = (\(V2 a' b') -> V4 a' b' c d) <$> f (V2 a b)
src/Linear/Vector.hs view
@@ -3,9 +3,11 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeFamilies #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |--- Module      :  Linear.Vector -- Copyright   :  (C) 2012 Edward Kmett -- License     :  BSD-style (see the file LICENSE) -- Maintainer  :  Edward Kmett <ekmett@gmail.com>