
25 Nov
2016
25 Nov
'16
1:36 a.m.
data X =
A1 { name :: String, d :: Double}
| A2 { name :: String, i :: Int}
| A3 { name :: String, d1 :: Double, i1 :: Int}
Now you can use `name` directly to get the string component of the
different variants.
Hope that helps!
Rahul
On Fri, Nov 25, 2016 at 11:16 AM,
Here's what I'm doing:
data X = A1 String Double | A2 String Int | A3 String Double Int
name c = case c of A1 name _ -> name A2 name _ -> name A3 name _ _ -> name
I'm sure there's a better way... _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- Rahul Muttineni