[Haskell] Re: ANNOUNCE: countable-0.1
Maciej Piechotka
uzytkownik2 at gmail.com
Mon Sep 6 14:23:01 EDT 2010
On Mon, 2010-09-06 at 03:54 -0700, Ashley Yakeley wrote:
> countable: Countable, Searchable, Finite, Empty classes.
>
> class Countable, for countable types
> class AtLeastOneCountable, for countable types that have at least one
> value
> class InfiniteCountable, for infinite countable types
> class Searchable, for types that can be searched over
> class Finite, for finite types
> class Empty, for empty types
> data Nothing, an empty type
>
> Also includes these orphan instances:
>
> instance (Searchable a,Eq b) => Eq (a -> b)
> instance (Finite a) => Foldable ((->) a)
> instance (Finite a) => Traversable ((->) a)
> instance (Show a,Finite a,Show b) => Show (a -> b)
>
> It turns out Searchable includes some infinite types. Specifically,
> countable implements this:
>
> instance (Countable c,Searchable s) => Searchable (c -> s)
>
> using the algorithm described here:
>
> http://math.andrej.com/2007/09/28/seemingly-impossible-functional-programs/
>
> I would welcome improvements.
>
> http://hackage.haskell.org/package/countable-0.1
> cabal install countable
> darcs get http://code.haskell.org/countable/
>
> See also this thread:
> http://thread.gmane.org/gmane.comp.lang.haskell.cafe/73275
>
Hmm.
1. Code formatting is very C#-like. At least for me it is hard to read
the code that way (it IS matter of preference however)
2. countMaybeNext seems to need documentation. If I understand it
correctly:
countMaybeNext Nothing = 'minimalValue'
countMaybeNext (Just x) = x + 1
Wouldn't be split it to:
countNext :: a -> Maybe a
initial :: Maybe a
3.
Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell/attachments/20100906/aa769a1a/attachment.bin
More information about the Haskell
mailing list