universe-instances-extended (empty) → 1.0
raw patch · 4 files changed
+98/−0 lines, 4 filesdep +adjunctionsdep +basedep +comonadsetup-changed
Dependencies added: adjunctions, base, comonad, universe-instances-base, void
Files
- Data/Universe/Instances/Extended.hs +38/−0
- LICENSE +30/−0
- Setup.hs +2/−0
- universe-instances-extended.cabal +28/−0
+ Data/Universe/Instances/Extended.hs view
@@ -0,0 +1,38 @@+{-# LANGUAGE FlexibleContexts #-}+module Data.Universe.Instances.Extended (+ -- | Instances for 'Universe' and 'Finite' for function-like functors and the empty type.+ Universe(..), Finite(..)+ ) where++import Data.Void+import Control.Comonad.Trans.Traced+import Data.Functor.Rep+import Data.Universe.Instances.Base++instance Universe Void where universe = []++-- We could do this:+--+-- instance Universe (f a) => Universe (Co f a) where universe = map Rep universe+--+-- However, since you probably only apply Rep to functors when you want to+-- think of them as being representable, I think it makes sense to use an+-- instance based on the representable-ness rather than the inherent+-- universe-ness.+--+-- Please complain if you disagree!+instance (Representable f, Finite (Rep f), Ord (Rep f), Universe a)+ => Universe (Co f a)+ where universe = map tabulate universe+instance (Representable f, Finite s, Ord s, Finite (Rep f), Ord (Rep f), Universe a)+ => Universe (TracedT s f a)+ where universe = map tabulate universe++instance Finite Void++instance (Representable f, Finite (Rep f), Ord (Rep f), Finite a)+ => Finite (Co f a)+ where universeF = map tabulate universeF+instance (Representable f, Finite s, Ord s, Finite (Rep f), Ord (Rep f), Finite a)+ => Finite (TracedT s f a)+ where universeF = map tabulate 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-extended.cabal view
@@ -0,0 +1,28 @@+name: universe-instances-extended+version: 1.0+synopsis: Universe instances for types from select extra 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.Extended+ build-depends: adjunctions >=4 && <4.1,+ base >=4 && <5 ,+ comonad >=4 && <4.1,+ universe-instances-base >=1.0 && <1.1,+ void >=0.1 && <0.7+ default-language: Haskell2010