mono-traversable-instances-0.1.1.0/src/0000755000000000000000000000000013705040110016060 5ustar0000000000000000mono-traversable-instances-0.1.1.0/src/Data/0000755000000000000000000000000013705040110016731 5ustar0000000000000000mono-traversable-instances-0.1.1.0/src/Data/MonoTraversable/0000755000000000000000000000000013705040110022034 5ustar0000000000000000mono-traversable-instances-0.1.1.0/src/Data/MonoTraversable/Instances.hs0000644000000000000000000001040213705040604024324 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.MonoTraversable.Instances () where import Data.DList.Instances () import Data.Traversable.Instances () import Data.Functor.Apply (MaybeApply (..), WrappedApplicative) import Control.Comonad (Cokleisli, Comonad, extract, extend) import Control.Comonad.Store (StoreT) import Control.Comonad.Env (EnvT) import Control.Comonad.Traced (TracedT) import Data.DList (DList) import Data.Semigroupoid.Static (Static) import qualified Data.DList as DL import Data.Vector.Instances () import Data.MonoTraversable import Data.Sequences #if !MIN_VERSION_base(4,8,0) import Control.Monad (liftM) #endif import Control.Monad.Trans.Identity (IdentityT) import Data.Semigroup (Arg) import Data.List.NonEmpty (NonEmpty) import Data.Functor.Identity (Identity) import Data.Tree (Tree) import Data.Traversable (traverse) import Control.Applicative (Applicative) import Data.Monoid (Monoid) #if !MIN_VERSION_comonad(5,0,0) import Data.Functor.Coproduct (Coproduct) #endif type instance Element (DList a) = a instance MonoFoldable (DList a) where otoList = DL.toList headEx = DL.head {-# INLINE otoList #-} {-# INLINE headEx #-} instance MonoTraversable (DList a) where otraverse f = fmap DL.fromList . Data.Traversable.traverse f . DL.toList #if !MIN_VERSION_base(4,8,0) omapM f = liftM DL.fromList . mapM f . DL.toList #endif instance MonoFunctor (DList a) instance MonoPointed (DList a) instance GrowingAppend (DList a) instance SemiSequence (DList a) where type Index (DList a) = Int cons = DL.cons snoc = DL.snoc reverse = defaultReverse sortBy = defaultSortBy intersperse = defaultIntersperse find = defaultFind {-# INLINE intersperse #-} {-# INLINE reverse #-} {-# INLINE find #-} {-# INLINE sortBy #-} {-# INLINE cons #-} {-# INLINE snoc #-} instance IsSequence (DList a) where fromList = DL.fromList replicate = DL.replicate #if MIN_VERSION_dlist(1,0,0) tailEx = DL.fromList . DL.tail #else tailEx = DL.tail #endif {-# INLINE fromList #-} {-# INLINE replicate #-} {-# INLINE tailEx #-} type instance Element (Cokleisli w a b) = b instance MonoFunctor (Cokleisli w a b) instance MonoPointed (Cokleisli w a b) type instance Element (WrappedApplicative f a) = a instance Control.Applicative.Applicative f => MonoPointed (WrappedApplicative f a) instance Functor f => MonoFunctor (WrappedApplicative f a) type instance Element (MaybeApply f a) = a instance Functor f => MonoFunctor (MaybeApply f a) instance MonoPointed (MaybeApply f a) where opoint = MaybeApply . Right {-# INLINE opoint #-} type instance Element (TracedT m w a) = a instance (Comonad w, Data.Monoid.Monoid m) => MonoComonad (TracedT m w a) where oextract = extract oextend = extend instance Functor w => MonoFunctor (TracedT m w a) type instance Element (StoreT s w a) = a instance Comonad w => MonoComonad (StoreT s w a) where oextract = extract oextend = extend instance Functor w => MonoFunctor (StoreT s w a) type instance Element (EnvT e w a) = a instance Comonad w => MonoComonad (EnvT e w a) where oextract = extract oextend = extend instance Functor w => MonoFunctor (EnvT e w a) #if !MIN_VERSION_comonad(5,0,0) type instance Element (Coproduct f g a) = a instance (Functor f, Functor g) => MonoFunctor (Coproduct f g a) instance (Comonad f, Comonad g) => MonoComonad (Coproduct f g a) where oextract = extract oextend = extend #endif type instance Element (Static f a b) = b instance Applicative f => MonoPointed (Static f a b) instance Functor f => MonoFunctor (Static f a b) instance Comonad w => MonoComonad (IdentityT w a) where oextract = extract oextend = extend -- Comonad instance MonoComonad (Tree a) where oextract = extract oextend = extend instance MonoComonad (NonEmpty a) where oextract = extract oextend = extend instance MonoComonad (Identity a) where oextract = extract oextend = extend instance Monoid m => MonoComonad (m -> a) where oextract = extract oextend = extend instance MonoComonad (e, a) where oextract = extract oextend = extend instance MonoComonad (Arg a b) where oextract = extract oextend = extend mono-traversable-instances-0.1.1.0/LICENSE0000644000000000000000000000207713705040110016304 0ustar0000000000000000Copyright (c) 2016 Michael Snoyman, http://www.fpcomplete.com/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. mono-traversable-instances-0.1.1.0/Setup.hs0000644000000000000000000000005613705040110016726 0ustar0000000000000000import Distribution.Simple main = defaultMain mono-traversable-instances-0.1.1.0/mono-traversable-instances.cabal0000644000000000000000000000245113705040474023541 0ustar0000000000000000cabal-version: 1.12 -- This file has been generated from package.yaml by hpack version 0.33.0. -- -- see: https://github.com/sol/hpack -- -- hash: 25b05459047be752b6fdc6867bde65e9e5af9d68f1a1f25a54f473dbcfa96492 name: mono-traversable-instances version: 0.1.1.0 synopsis: Extra typeclass instances for mono-traversable description: See docs and README at category: Data homepage: https://github.com/snoyberg/mono-traversable#readme bug-reports: https://github.com/snoyberg/mono-traversable/issues author: Michael Snoyman maintainer: michael@fpcomplete.com license: MIT license-file: LICENSE build-type: Simple extra-source-files: README.md ChangeLog.md source-repository head type: git location: https://github.com/snoyberg/mono-traversable library exposed-modules: Data.MonoTraversable.Instances other-modules: Paths_mono_traversable_instances hs-source-dirs: src build-depends: base >=4.10 && <5 , comonad >=3.0.3 , containers , dlist >=0.6 && <1.1 , dlist-instances ==0.1.* , mono-traversable >=1.0 && <1.1 , semigroupoids >=3.0 , semigroups , transformers , vector-instances default-language: Haskell2010 mono-traversable-instances-0.1.1.0/README.md0000644000000000000000000000023513705040110016550 0ustar0000000000000000## mono-traversable-instances Extra typeclass instances for mono-traversable Set up this way to allow mono-traversable itself to have minimal dependencies mono-traversable-instances-0.1.1.0/ChangeLog.md0000644000000000000000000000015313705040372017453 0ustar0000000000000000# Changelog for mono-traversable-instances ## 0.1.1.0 * Support dlist 1.0 ## 0.1.0.0 * Initial release