To my example-question on using existential type
Michael Hobbs [EMAIL PROTECTED] writes
[...]
But my real point in replying to this message is to see if you actually
need a multi-type list. Do you really *need* to have separate types for
DMeat, DVine, etc.? For example, instead of having:
Nick Kallen [EMAIL PROTECTED] wrote:
apply f (p:ps) = apply (f p) ps
apply f [] = f
I wanted to express the type as something like:
apply :: (a - a - ... - a) [a] - a
No, that's not what you want. :-) You want
apply :: (a - a - ... - b) [a] - b
I think the distinction is important
I wanted to express the type as something like:
apply :: (a - a - ... - a) [a] - a
No, that's not what you want. :-) You want
apply :: (a - a - ... - b) [a] - b
I think the distinction is important (see below).
F a * = member (map (F a) [0..]) // member [a] a - Bool
I mave no
If your language supports optional dynamic type checking, as it should,
then expressing functions like apply shouldn't be too hard.
Here's a dynamic apply in a pseudo Clean 2.0 syntax:
apply :: Dynamic [a] - a
apply (f :: a - b) (arg:args) = apply (dynamic (f arg) :: b) args
apply (f :: a) []
Fergus Henderson wrote:
What would happen if `write' was called with an MVar variable and an
Error variable? Would the `exitWith' function get called, or would the
`putMVar' function get called?
Haskell doesn't normally let you define clauses for the same function
in different modules.