[Haskell-beginners] Abstracting Data.List

Peter Hall peter.hall at memorphic.com
Fri May 31 12:44:29 CEST 2013


http://hackage.haskell.org/packages/archive/ListLike/3.1.4/doc/html/Data-ListLike.html

Peter


On 31 May 2013 11:16, mukesh tiwari <mukeshtiwari.iiitm at gmail.com> wrote:

> Hi Giacomo,
> Data.List can be abstracted using Foldable and Traversable but
> unfortunately I could not find the functions corresponding to head, take.
>
> Prelude Data.Traversable Data.Foldable> :t Data.Foldable.
> Data.Foldable.Foldable    Data.Foldable.concatMap
> Data.Foldable.foldl'      Data.Foldable.foldrM
> Data.Foldable.minimum     Data.Foldable.sequenceA_
> Data.Foldable.all         Data.Foldable.elem
> Data.Foldable.foldl1      Data.Foldable.forM_
> Data.Foldable.minimumBy   Data.Foldable.sequence_
> Data.Foldable.and         Data.Foldable.find
> Data.Foldable.foldlM      Data.Foldable.for_
> Data.Foldable.msum        Data.Foldable.sum
> Data.Foldable.any         Data.Foldable.fold
> Data.Foldable.foldr       Data.Foldable.mapM_
> Data.Foldable.notElem     Data.Foldable.toList
> Data.Foldable.asum        Data.Foldable.foldMap
> Data.Foldable.foldr'      Data.Foldable.maximum
> Data.Foldable.or          Data.Foldable.traverse_
> Data.Foldable.concat      Data.Foldable.foldl
> Data.Foldable.foldr1      Data.Foldable.maximumBy   Data.Foldable.product
> Prelude Data.Traversable Data.Foldable> :t Data.Traversable.
> Data.Traversable.Traversable     Data.Traversable.for
> Data.Traversable.mapAccumR       Data.Traversable.sequenceA
> Data.Traversable.fmapDefault     Data.Traversable.forM
> Data.Traversable.mapM            Data.Traversable.traverse
> Data.Traversable.foldMapDefault  Data.Traversable.mapAccumL
> Data.Traversable.sequence
> Prelude Data.Traversable Data.Foldable> :i Foldable
> class Foldable t where
>   fold :: Data.Monoid.Monoid m => t m -> m
>   foldMap :: Data.Monoid.Monoid m => (a -> m) -> t a -> m
>   Data.Foldable.foldr :: (a -> b -> b) -> b -> t a -> b
>   foldr' :: (a -> b -> b) -> b -> t a -> b
>   Data.Foldable.foldl :: (a -> b -> a) -> a -> t b -> a
>   foldl' :: (a -> b -> a) -> a -> t b -> a
>   Data.Foldable.foldr1 :: (a -> a -> a) -> t a -> a
>   Data.Foldable.foldl1 :: (a -> a -> a) -> t a -> a
>       -- Defined in `Data.Foldable'
> instance Foldable [] -- Defined in `Data.Foldable'
> instance Foldable Maybe -- Defined in `Data.Foldable'
> Prelude Data.Traversable Data.Foldable> :i Tr
> Traversable  True
> Prelude Data.Traversable Data.Foldable> :i Traversable
> class (Functor t, Foldable t) => Traversable t where
>   traverse ::
>     Control.Applicative.Applicative f => (a -> f b) -> t a -> f (t b)
>   sequenceA ::
>     Control.Applicative.Applicative f => t (f a) -> f (t a)
>   Data.Traversable.mapM :: Monad m => (a -> m b) -> t a -> m (t b)
>   Data.Traversable.sequence :: Monad m => t (m a) -> m (t a)
>       -- Defined in `Data.Traversable'
> instance Traversable [] -- Defined in `Data.Traversable'
> instance Traversable Maybe -- Defined in `Data.Traversable'
> Prelude Data.Traversable Data.Foldable> :t foldMap
> foldMap
>   :: (Foldable t, Data.Monoid.Monoid m) => (a -> m) -> t a -> m
>
> -Mukesh
>
>
> On Fri, May 31, 2013 at 2:26 PM, Giacomo Tesio <giacomo at tesio.it> wrote:
>
>> I'm looking for a class abstracting Data.List. I mean something that
>> enable the use of say head, map, take and so on into different kind of
>> types.
>>
>> Is there already something like that?
>>
>>
>> Giacomo
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130531/519eb7b3/attachment.htm>


More information about the Beginners mailing list