universe-instances-trans (empty) → 1.0
raw patch · 4 files changed
+85/−0 lines, 4 filesdep +basedep +mtldep +transformerssetup-changed
Dependencies added: base, mtl, transformers, universe-base, universe-instances-base
Files
- Data/Universe/Instances/Trans.hs +24/−0
- LICENSE +30/−0
- Setup.hs +2/−0
- universe-instances-trans.cabal +29/−0
+ Data/Universe/Instances/Trans.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE FlexibleContexts #-}+module Data.Universe.Instances.Trans (+ -- | Instances of 'Universe' and 'Finite' for the standard monad and functor transformers.+ Universe(..), Finite(..)+ ) where++import Control.Monad.Identity+import Control.Monad.Reader+import Control.Monad.Trans.Identity+import Data.Functor.Compose+import Data.Functor.Product+import Data.Universe.Helpers+import Data.Universe.Instances.Base++instance Universe a => Universe (Identity a) where universe = map Identity universe+instance Universe (f a) => Universe (IdentityT f a) where universe = map IdentityT universe+instance (Finite e, Ord e, Universe (m a)) => Universe (ReaderT e m a) where universe = map ReaderT universe+instance Universe (f (g a)) => Universe (Compose f g a) where universe = map Compose universe+instance (Universe (f a), Universe (g a)) => Universe (Product f g a) where universe = [Pair f g | (f, g) <- universe +*+ universe]+instance Finite a => Finite (Identity a) where universeF = map Identity universeF+instance Finite (f a) => Finite (IdentityT f a) where universeF = map IdentityT universeF+instance (Finite e, Ord e, Finite (m a)) => Finite (ReaderT e m a) where universeF = map ReaderT universeF+instance Finite (f (g a)) => Finite (Compose f g a) where universeF = map Compose universeF+instance (Finite (f a), Finite (g a)) => Finite (Product f g a) where universeF = liftM2 Pair universeF universeF
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2013, Daniel Wagner++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Daniel Wagner nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++! This software is provided by the copyright holders and contributors+! "as is" and any express or implied warranties, including, but not+! limited to, the implied warranties of merchantability and fitness for+! a particular purpose are disclaimed. In no event shall the copyright+! owner or contributors be liable for any direct, indirect, incidental,+! special, exemplary, or consequential damages (including, but not+! limited to, procurement of substitute goods or services; loss of use,+! data, or profits; or business interruption) however caused and on any+! theory of liability, whether in contract, strict liability, or tort+! (including negligence or otherwise) arising in any way out of the use+! of this software, even if advised of the possibility of such damage.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ universe-instances-trans.cabal view
@@ -0,0 +1,29 @@+name: universe-instances-trans+version: 1.0+synopsis: Universe instances for types from the transformers and mtl packages+homepage: https://github.com/dmwit/universe+license: BSD3+license-file: LICENSE+author: Daniel Wagner+maintainer: me@dmwit.com+copyright: Daniel Wagner 2014+category: Data+build-type: Simple+cabal-version: >=1.10+source-repository head+ type: git+ location: https://github.com/dmwit/universe+source-repository this+ type: git+ location: https://github.com/dmwit/universe+ tag: 1.0++library+ exposed-modules: Data.Universe.Instances.Trans+ build-depends: base >=4 && <5 ,+ mtl >=1.0 && <2.2,+ transformers >=0.2 && <0.4,+ universe-base >=1.0 && <1.1,+ universe-instances-base >=1.0 && <1.1+ default-language: Haskell2010+ other-extensions: FlexibleContexts