
Hi Christopher, On Fri, Dec 21, 2012 at 04:36:04AM -0900, Christopher Howard wrote:
Using a simple type I gave earlier from my monadic type question...
code: -------- data Socket3 a b c = Socket3 a b c deriving (Show) --------
Is it possible somehow to layer on record syntax onto a synonym of the type?
The idea would be something like this...
code: -------- type SpaceShip = Socket3 { engine :: Last Engine , hull :: Last Hull , guns :: [Guns] } --------
...purely for the convenience. But this doesn't seem to work with "type" as it assumes you are referring to already made constructors, and evidently "newtype" only allows use of a single record. I could wrap it in a normal "data" declaration but that would add an extra layer of complexity I think.
I don't know in which context you would like to use the SpaceShip type, but the solution using the very generic Socket3 might bite you later, because you don't have a concrete type for your SpaceShip and can't identify it. Why having a Socket3 in the first place, what's the point of it?
-- frigidcode.com
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe