Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  implicit or shorthand class instances? (Christopher Howard)


----------------------------------------------------------------------

Message: 1
Date: Thu, 29 Nov 2012 12:52:38 -0900
From: Christopher Howard <[email protected]>
Subject: [Haskell-beginners] implicit or shorthand class instances?
To: Haskell Beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

There is a lot of code in my project like so:

code:
--------
data SomeThing =
  Something { center :: ...
              velocity :: ...
              ...
            }

instance Locatable SomeThing where
  center = Something.center

instance Moving SomeThing where
  velocity = Something.velocity

instance ...
--------

Is there any special extension or syntax trick that would allow me to
reduce the amount of this repetitious code? Someway to implicitly state
that the functions in the data type are equal to the functions in the
class instance, rather than having to spell it out?

-- 
frigidcode.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20121129/c16caea6/attachment-0001.pgp>

------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 53, Issue 36
*****************************************

Reply via email to