[darcs-devel] changing (PatchInfo, Maybe Patch) to (PatchInfo,
Hopefully Patch)
David Roundy
droundy at darcs.net
Sat Dec 9 12:13:21 PST 2006
On Sat, Dec 09, 2006 at 11:50:57AM -0800, Jason Dagit wrote:
> On 12/9/06, David Roundy <droundy at darcs.net> wrote:
> >Hi all,
> >
> >I've just started (an hour ago) converting all the (PatchInfo, Maybe Patch)
> >instances in darcs to (PatchInfo, Hopefully Patch) where
> >
> >data Hopefully a = Actually a | Unavailable String
>
> Is there a reason to not use 'Either a String' instead? That's the
> common way to handle error propagation (Either is a commonly used
> instance of MonadError).
>
> Obviously creating new datatypes is easy in Haskell, but is it the
> right thing here? Maybe we just need 'type Hopefully a = Either a
> String' instead.
I started out with type Hopefully = Either String, but you can't make that
a monad, since it overlaps with MonadError. And there's a lot of Eithers
in the code already, and I'd like to be able to easily and typesafely
change just one of them.
--
David Roundy
Department of Physics
Oregon State University
More information about the darcs-devel
mailing list