[Haskell-cafe] Type families not as useful over functions

George Pollard porges at porg.es
Fri Feb 13 00:50:28 EST 2009


> Can you live with
>    infixl |$|
>    (|$|) :: [a -> r] -> a -> [r]
>    fs |$| x = map ($ x) fs
> and, instead of "broadcast fs a b" use
>    fs |$| a |$| b
> ?

  map ($ x) fs
= { Applicative Functors satisfy... }
  pure ($ x) <*> fs
= { 'interchange' rule from Control.Applicative }
  fs <*> pure x

Thus;
  fs |$| x === fs <*> pure x
  fs |$| x |$| y === fs <*> pure x <*> pure y

- George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090213/30b0c864/attachment.bin


More information about the Haskell-Cafe mailing list