Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-24 Thread Claus Reinke
As far as referential transparency is concerned, you'd need to keep your reference levels straight, which can seem confusing if you can only communicate via representations(*:-) That came out more confusing than it needs to be, so let me try that again, from scratch: Reduction systems take

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-23 Thread Dan Weston
Subject: Re: [Haskell-cafe] Overriding a Prelude function? To: michael rice nowg...@yahoo.com Cc: Ross Mellgren rmm-hask...@z.odi.ac, Dan Weston weston...@imageworks.com, haskell-cafe@haskell.org haskell-cafe@haskell.org Date: Wednesday, April 22, 2009, 5:02 PM On Wed

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-23 Thread Claus Reinke
*Main :t rollDie ~ (rollDie ~ rollDie) rollDie ~ (rollDie ~ rollDie) :: Seed - (Int, Seed) This is a function. How exactly do you want ghci to show it? When you figure that out, feel free to make an instance of Show for it. Just because user programs can't show function internals (they can

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-23 Thread Miguel Mitrofanov
On 23 Apr 2009, at 23:07, Claus Reinke wrote: *Main :t rollDie ~ (rollDie ~ rollDie) rollDie ~ (rollDie ~ rollDie) :: Seed - (Int, Seed) This is a function. How exactly do you want ghci to show it? When you figure that out, feel free to make an instance of Show for it. Just because user

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-23 Thread Luke Palmer
On Thu, Apr 23, 2009 at 1:34 PM, Miguel Mitrofanov miguelim...@yandex.ruwrote: Well, than, what would you expect from this: let {f x = g x; g 0 = 0; g n = f (n-1)} in show f Well, not show, because any show instance for functions breaks r.t. But the interactive interpreter, if

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-23 Thread Claus Reinke
Well, than, what would you expect from this: let {f x = g x; g 0 = 0; g n = f (n-1)} in show f Well, not show, because any show instance for functions breaks r.t. But the interactive interpreter, if it is not subject to r.t., might show: let { f x = g x; g 0 = 0; g n = f

[Haskell-cafe] Overriding a Prelude function?

2009-04-22 Thread michael rice
I've been working through this example from: http://en.wikibooks.org/wiki/Haskell/Understanding_monads I understand what they're doing all the way up to the definition of (), which duplicates Prelude function (). To continue following the example, I need to know how to override the Prelude ()

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-22 Thread Ross Mellgren
I think import Prelude hiding (()) does that. -Ross On Apr 22, 2009, at 11:44 AM, michael rice wrote: I've been working through this example from: http://en.wikibooks.org/wiki/Haskell/Understanding_monads I understand what they're doing all the way up to the definition of (), which

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-22 Thread Tim Wawrzynczak
You can try at the top Import Prelude hiding () On Wed, Apr 22, 2009 at 10:44 AM, michael rice nowg...@yahoo.com wrote: I've been working through this example from: http://en.wikibooks.org/wiki/Haskell/Understanding_monads I understand what they're doing all the way up to the definition of

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-22 Thread Dan Weston
Be aware that the do unsugars to (Prelude.), not your (), even if you hide (Prelude.): import Prelude hiding (()) m f = error Call me! main = putStrLn . show $ do [3,4] [5] The desugaring of the do { [3,4]; [5] } is (Prelude.) [3,4] [5] = [5,5], whereas you might

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-22 Thread Ross Mellgren
True enough -- if you really want to redefine the monadic operator, you have to use {-# LANGUAGE NoImplicitPrelude #-} import Prelude hiding ((), (=), return) or something like it, although Michael's example didn't appear to be going quite that far. -Ross On Apr 22, 2009, at 12:37 PM,

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-22 Thread Thomas van Noort
You can hide () from the implicit import of Prelude using: import Prelude hiding (()) Kind regards, Thomas michael rice wrote: I've been working through this example from: http://en.wikibooks.org/wiki/Haskell/Understanding_monads I understand what they're doing all the way up to the

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-22 Thread michael rice
is unsugar? Thanks in advance for your patience. Michael --- On Wed, 4/22/09, Dan Weston weston...@imageworks.com wrote: From: Dan Weston weston...@imageworks.com Subject: Re: [Haskell-cafe] Overriding a Prelude function? To: Ross Mellgren rmm-hask...@z.odi.ac Cc: michael rice nowg...@yahoo.com

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-22 Thread Luke Palmer
--- On *Wed, 4/22/09, Dan Weston weston...@imageworks.com* wrote: From: Dan Weston weston...@imageworks.com Subject: Re: [Haskell-cafe] Overriding a Prelude function? To: Ross Mellgren rmm-hask...@z.odi.ac Cc: michael rice nowg...@yahoo.com, haskell-cafe@haskell.org haskell-cafe@haskell.org Date

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-22 Thread michael rice
declaration for (Show (Seed - (Int, Seed)))     In a stmt of a 'do' expression: print it *Main Michael --- On Wed, 4/22/09, Luke Palmer lrpal...@gmail.com wrote: From: Luke Palmer lrpal...@gmail.com Subject: Re: [Haskell-cafe] Overriding a Prelude function? To: michael rice nowg...@yahoo.com Cc