Not always. For example, you can't mess with the declaration of a standard class, such as Num. On Sun, Apr 28, 2013 at 12:06 PM, Edward Kmett <ekmett@gmail.com> wrote:
You can always put those helper functions in the class and then just not export them from the module.
On Sun, Apr 28, 2013 at 10:49 AM, Doug McIlroy <doug@cs.dartmouth.edu>wrote:
Is there any strong reason why the where clause in an instance declaration cannot declare anything other than class operators? If not, I suggest relaxing the restriction.
It is not unusual for declarations of class operators to refer to special auxiliary functions. Under current rules such functions have to be declared outside the scope in which they are used.
Doug McIlroy
Makes sense. I'm not sure what a good syntactic story would be for that feature though. Just writing down member names that aren't in the class seems to be too brittle and error prone, and new keywords seems uglier than the current situation. Sent from my iPad On Apr 28, 2013, at 1:24 PM, Doug McIlroy <doug@cs.dartmouth.edu> wrote:
Not always. For example, you can't mess with the declaration of a standard class, such as Num.
On Sun, Apr 28, 2013 at 12:06 PM, Edward Kmett <ekmett@gmail.com> wrote:
You can always put those helper functions in the class and then just not export them from the module.
On Sun, Apr 28, 2013 at 10:49 AM, Doug McIlroy <doug@cs.dartmouth.edu>wrote:
Is there any strong reason why the where clause in an instance declaration cannot declare anything other than class operators? If not, I suggest relaxing the restriction.
It is not unusual for declarations of class operators to refer to special auxiliary functions. Under current rules such functions have to be declared outside the scope in which they are used.
Doug McIlroy
You could probably get away with just using two "where" clauses: instance Foo a where bar = ... where auxilliary = ... On 28 April 2013 18:42, Edward Kmett <ekmett@gmail.com> wrote:
Makes sense. I'm not sure what a good syntactic story would be for that feature though. Just writing down member names that aren't in the class seems to be too brittle and error prone, and new keywords seems uglier than the current situation.
Sent from my iPad
On Apr 28, 2013, at 1:24 PM, Doug McIlroy <doug@cs.dartmouth.edu> wrote:
Not always. For example, you can't mess with the declaration of a standard class, such as Num.
On Sun, Apr 28, 2013 at 12:06 PM, Edward Kmett <ekmett@gmail.com> wrote:
You can always put those helper functions in the class and then just not export them from the module.
On Sun, Apr 28, 2013 at 10:49 AM, Doug McIlroy <doug@cs.dartmouth.edu wrote:
Is there any strong reason why the where clause in an instance declaration cannot declare anything other than class operators? If not, I suggest relaxing the restriction.
It is not unusual for declarations of class operators to refer to special auxiliary functions. Under current rules such functions have to be declared outside the scope in which they are used.
Doug McIlroy
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime
Hello, I think that if we want something along those lines, we should consider a more general construct that allows declarations to scope over other declarations (like SML's `local` construct). It would be quite arbitrary to restrict this only to instances. -Iavor On Mon, Apr 29, 2013 at 2:41 PM, Max Bolingbroke <batterseapower@hotmail.com
wrote:
You could probably get away with just using two "where" clauses:
instance Foo a where bar = ... where auxilliary = ...
On 28 April 2013 18:42, Edward Kmett <ekmett@gmail.com> wrote:
Makes sense. I'm not sure what a good syntactic story would be for that feature though. Just writing down member names that aren't in the class seems to be too brittle and error prone, and new keywords seems uglier than the current situation.
Sent from my iPad
On Apr 28, 2013, at 1:24 PM, Doug McIlroy <doug@cs.dartmouth.edu> wrote:
Not always. For example, you can't mess with the declaration of a standard class, such as Num.
On Sun, Apr 28, 2013 at 12:06 PM, Edward Kmett <ekmett@gmail.com> wrote:
You can always put those helper functions in the class and then just not export them from the module.
On Sun, Apr 28, 2013 at 10:49 AM, Doug McIlroy <doug@cs.dartmouth.edu wrote:
Is there any strong reason why the where clause in an instance declaration cannot declare anything other than class operators? If not, I suggest relaxing the restriction.
It is not unusual for declarations of class operators to refer to special auxiliary functions. Under current rules such functions have to be declared outside the scope in which they are used.
Doug McIlroy
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime
participants (4)
-
Doug McIlroy -
Edward Kmett -
Iavor Diatchki -
Max Bolingbroke