[Haskell-beginners] Trying to write netwire combiner similar to multicast
Ertugrul Söylemez
es at ertes.de
Tue Nov 6 16:00:01 CET 2012
Nathan Hüsken <nathan.huesken at posteo.de> wrote:
> > The problem with such an interface is the inflexibility. Notice
> > that removing a subwire will change the numbering of all subsequent
> > wires. The interface I suggested follows this basic idea:
> >
> > shrinking ::
> > (Monad m)
> > => [(a' -> a, Wire e m a b)]
> > -> Wire e m a' b
>
> That should be ".. -> Wire e m a' [b]", correct?
Yes, of course.
> > The reasoning is that this way you disconnect the individual values
> > from the positions in the subwire list. This will also make writing
> > the combinator a bit simpler. If you will here is an interesting
> > alternative:
> >
> > data Subwire e m a b =
> > forall a'. Subwire (a -> a') (Wire e m a' b)
> >
> > shrinking :: (Monad m) => [Subwire e m a b] -> Wire e m a b
>
> Ohh, the scary forall keyword :).
> Here it does nothing but hide the a' type from the type signature, is
> that correct?
It also localizes error messages to where your subwire is defined.
Greets,
Ertugrul
--
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20121106/9d0c71e0/attachment.pgp>
More information about the Beginners
mailing list