Re: [Haskell-cafe] monomorphism restriction

2008-06-16 Thread Ryan Ingram
On 6/11/08, Jonathan Cast [EMAIL PROTECTED] wrote: This doesn't apply to f, though --- it has a function type, so the user presumably already knows it won't be subject to updating, no? Distinguishing functions from variables by the form of declaration, rather than the type, seems somewhat

Re: [Haskell-cafe] monomorphism restriction

2008-06-14 Thread Rafal Kolanski
Ryan Ingram wrote: sumns 0 = 0 sumns x = sumns (x-1) + n Without the monomorphism restriction, computing n is a function call; it is evaluated each time it is asked for. I'm relatively new to Haskell, and since this topic already came up, I was wondering if anyone could explain to me how

Re: [Haskell-cafe] monomorphism restriction

2008-06-14 Thread Jonathan Cast
On Sat, 2008-06-14 at 17:19 +1000, Rafal Kolanski wrote: Ryan Ingram wrote: sumns 0 = 0 sumns x = sumns (x-1) + n Without the monomorphism restriction, computing n is a function call; it is evaluated each time it is asked for. I'm relatively new to Haskell, and since this topic

Re: [Haskell-cafe] monomorphism restriction

2008-06-13 Thread Ryan Ingram
On 6/11/08, Rex Page [EMAIL PROTECTED] wrote: Please remind me, again, of the advantages of f being something different from the formula defining it. fibs !a !b = a : fibs b (a+b) -- fibs :: Num a = a - a - [a] n = head $ drop 100 $ fibs 1 1 -- n :: Integer (due to monomorphism

Re: [Haskell-cafe] monomorphism restriction

2008-06-13 Thread Jonathan Cast
On Wed, 2008-06-11 at 20:24 -0700, Don Stewart wrote: page: Definition of f: f = foldr (+) 0 Types: 0 :: (Num t) = t foldr (+) 0 :: Num a = [a] - a f :: [Integer] - Integer Please remind me, again, of the advantages of f being something different from the formula

[Haskell-cafe] monomorphism restriction

2008-06-11 Thread Rex Page
Definition of f: f = foldr (+) 0 Types: 0 :: (Num t) = t foldr (+) 0 :: Num a = [a] - a f :: [Integer] - Integer Please remind me, again, of the advantages of f being something different from the formula defining it. - Rex Page ___

Re: [Haskell-cafe] monomorphism restriction

2008-06-11 Thread Don Stewart
page: Definition of f: f = foldr (+) 0 Types: 0 :: (Num t) = t foldr (+) 0 :: Num a = [a] - a f :: [Integer] - Integer Please remind me, again, of the advantages of f being something different from the formula defining it. Overloaded 'constants' take a dictionary as an

Re: [Haskell-cafe] Monomorphism restriction

2007-01-25 Thread Yitzchak Gale
Neil Mitchell wrote: http://haskell.org/hawiki/MonomorphismRestriction Note to others (esp Cale): does this page not appear on the new wiki? I did a very rough quick conversion: http://www.haskell.org/haskellwiki/MonomorphismRestriction The old wiki is locked, for obvious reasons. But

[Haskell-cafe] Monomorphism restriction

2007-01-23 Thread Marco TĂșlio Gontijo e Silva
Hello, I talked for a while with bd_ about this on #haskell, and I think maybe I'm just being silly. But I can't get why: lambda = \x - length (show x) or dot = length . show is different from pre x = length $ show x I read about monomorphism restriction on the haskell 98 report, but I