::Int}
data B' = B'{c::Int}
foo :: MyData - Int
foo (A myA) = a myA
foo (B myB) = c myB
main :: IO ()
main = print $ foo (A (A' 1 2))
Timothy
-- Původní zpráva --
Od: John Meacham j...@repetae.net
Datum: 27. 5. 2012
Předmět: Re: [Haskell-cafe] Record syntax, reopening a can
myB) = c myB
main :: IO ()
main = print $ foo (A (A' 1 2))
Timothy
-- Původní zpráva --
Od: John Meacham j...@repetae.net
Datum: 27. 5. 2012
Předmět: Re: [Haskell-cafe] Record syntax, reopening a can of worms.
Is it any more ridiculous than
f x@Nothing {} = fromJust x
Somehow I don't understand you.
Could you please fill out your example into a working bit of code?
Thank you,
Timothy
-- Původní zpráva --
Od: Yves Parès limestr...@gmail.com
Datum: 27. 5. 2012
Předmět: Re: [Haskell-cafe] Record syntax, reopening a can of worms.
case
...@gmail.com
Datum: 27. 5. 2012
Předmět: Re: [Haskell-cafe] Record syntax, reopening a can of worms.
case myData of
myA@A{} - fooForA's myA
myB@B{} - fooForB's myB
I think this would typecheck if you used GADTs.
Actually what you'd want is to use the record syntax with GADTs
Is it any more ridiculous than
f x@Nothing {} = fromJust x
main = print (f Nothing)
crashing at run time? That is what you are expressing with your first
one. This issue is completely unrelated to the named field syntax,
they behave exactly like data types with non-named fields.
However, you