Re: Field labels must be globally unique?

2003-01-07 Thread Tom Pledger
A third way is to put each datatype declaration in a separate module and use qualified imports. ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Re: Field labels must be globally unique?

2003-01-07 Thread John Meacham
a plausable workaround in haskell 98 is to use a typeclass like so class EdgyNodelike a where node :: a -> Int edge0 :: a -> a edge1 :: a -> a instance EdgyNodelike BFSM where node = bfsmnode edge0 = bfsmedge0 edge1 = bfsmedge1 instance EdgyNodelik

Re: Field labels must be globally unique?

2003-01-07 Thread Andrew J Bromage
G'day all. On Tue, Jan 07, 2003 at 10:01:38PM -0600, Kim-Ee Yeoh wrote: > Why can't field labels have the same name in different types? Because it would generate two functions with the same name. > I'm not an expert on programming languages, but doesn't it seem > that Haskell, as a strongly-typ

Field labels must be globally unique?

2003-01-07 Thread Kim-Ee Yeoh
Dear Haskellers, Why can't field labels have the same name in different types? Here's some actual code on finite state automata I'm working on: > data BMC > = BMC { node :: !Int, > threshold :: !Float, > edge0 :: BMC, > edge1 :: BMC } > data BFSM

Re: dynamic types

2003-01-07 Thread Richard Uhtenwoldt
Hal Daume III writes: >You are correct. You can't say: > > let x = if ??? then () else (5::Integer) I meant to ask if when you do this next let x = if ??? then toDyn () else toDyn (5::Integer) can you then dispatch on x's type. In my sample code, I forgot the toDyns. eek! Anyway, this nex

Re: dynamic types

2003-01-07 Thread Andrew J Bromage
G'day all. On Wed, Jan 08, 2003 at 08:42:20AM +1100, Thomas Conway wrote: > I'm fairly new to Haskell, but worked on Mercury until recently. > Mercury has a type "univ" which might be declared something like: > > data Univ = Univ a The equivalent would be: data Univ = forall a. Univ a

Re: dynamic types

2003-01-07 Thread Hal Daume III
> I'm fairly new to Haskell, but worked on Mercury until recently. > Mercury has a type "univ" which might be declared something like: you would write this: data Univ = forall a . Univ a > mkUniv :: a -> Univ right, 'mkUniv = Univ' is sufficient. > getValue :: Univ -> Maybe a yes, this is the

Re: dynamic types

2003-01-07 Thread Thomas Conway
On Wed, 8 Jan 2003 07:19 am, Hal Daume III wrote: > Another way to do it would be to define a "universal" type: > > data Univ = UUnit () | UInteger Integer | UDouble Double | ... > I'm fairly new to Haskell, but worked on Mercury until recently. Mercury has a type "univ" which might be declared so

Re: dynamic types

2003-01-07 Thread Hal Daume III
You are correct. You can't say: let x = if ??? then () else (5::Integer) because then the compiler can't assign a type to x. However, to achieve what you want, you might try something like this (untested code follows): > main = do >l <- getLine >let x = case maybeRead l of >

dynamic types

2003-01-07 Thread Richard Uhtenwoldt
Just want to make sure I understand. There does not exist a Haskell implementation-specific extension which provides the sort of dynamic type that would allow one to discriminate at run time between built-in types; right? eg, main=do object<-readLn case object of --or some such syntax

CFP: Workshop on Model Checking and Artificial Intelligence (MoChArt-03)

2003-01-07 Thread Massimo Benerecetti
APOLOGIES IF YOU RECEIVE MORE THAN ONE COPY OF THIS MESSAGE. = CALL FOR PAPERS & PARTICIPATION *** SECOND WORKSHOP ON