I'd like to redefine (++) so that it works on a more general class of "lists" (ListOf a). To do this, I found that I can import the Prelude hiding the definition of (++). Then I want to make [] an instance of ListOf, and have the (++) function call the built-in Prelude.(++). My problem is that I can't figure out how to call the built-in function. Just using "Prelude.(++)" doesn't seem to work in the way that "Prelude.foldl" would (for example). Any ideas? Terry
Did you try (Prelude.++)? I think that's the way it needs to be done. Dan On Thu, Sep 24, 2009 at 8:59 PM, Terry Hayes <tdchayes@pacbell.net> wrote:
I'd like to redefine (++) so that it works on a more general class of "lists" (ListOf a). To do this, I found that I can import the Prelude hiding the definition of (++). Then I want to make [] an instance of ListOf, and have the (++) function call the built-in Prelude.(++).
My problem is that I can't figure out how to call the built-in function. Just using "Prelude.(++)" doesn't seem to work in the way that "Prelude.foldl" would (for example).
Any ideas?
Terry
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Thanks, you got me to head in the correct direction. I need to import Prelude twice, once without (++) and once qualified only for the (++) function. import Prelude hiding ( (++) ) import qualified Prelude ( (++) ) Terry ________________________________ From: Daniel Peebles <pumpkingod@gmail.com> To: Terry Hayes <tdchayes@pacbell.net> Cc: haskell-cafe@haskell.org Sent: Thursday, September 24, 2009 6:02:18 PM Subject: Re: [Haskell-cafe] Referring to Prelude.(++) Did you try (Prelude.++)? I think that's the way it needs to be done. Dan On Thu, Sep 24, 2009 at 8:59 PM, Terry Hayes <tdchayes@pacbell.net> wrote:
I'd like to redefine (++) so that it works on a more general class of "lists" (ListOf a). To do this, I found that I can import the Prelude hiding the definition of (++). Then I want to make [] an instance of ListOf, and have the (++) function call the built-in Prelude.(++).
My problem is that I can't figure out how to call the built-in function. Just using "Prelude.(++)" doesn't seem to work in the way that "Prelude.foldl" would (for example).
Any ideas?
Terry
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
Daniel Peebles -
Terry Hayes