Send Beginners mailing list submissions to
        beginners@haskell.org

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. Re:  variables in haskell (Brandon S. Allbery KF8NH)
   2.  Can we specify the module of the function being  referred
      (Amit Kumar Dhar)
   3. Re:  Can we specify the module of the function    being   referred
      (Tillmann Rendel)
   4. Re:  variables in haskell (Tillmann Rendel)
   5. Re:  variables in haskell (Matthew J. Williams)
   6. Re:  variables in haskell (Philippa Cowderoy)
   7.  Problems with ghc (Paul Johnston)
   8. Re:  Problems with ghc (Daniel Fischer)
   9. Re:  Problems with ghc (Paul Johnston)


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

Message: 1
Date: Mon, 13 Oct 2008 22:32:29 -0400
From: "Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] variables in haskell
To: "Matthew J. Williams" <[EMAIL PROTECTED]>
Cc: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

On 2008 Oct 13, at 2:58, Matthew J. Williams wrote:
> Hello listers, would one be correct in thinking that 'bound  
> variables' such as those used in haskell were in fact constants?


Only in certain limited circumstances.  Consider the following:

 > let x = f x in x

This finds the least defined fixed point of f.  See < 
http://en.wikibooks.org/wiki/Haskell/Fix_and_recursion 
  >.

Top level constant applicative forms (that is, bindings without  
arguments) with monomorphic types can generally be considered to be  
constants, and the compiler may assume this and inline it.  But it's  
not required to do so.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university    KF8NH




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

Message: 2
Date: Tue, 14 Oct 2008 11:12:17 +0530
From: "Amit Kumar Dhar" <[EMAIL PROTECTED]>
Subject: [Haskell-beginners] Can we specify the module of the function
        being   referred
To: beginners@haskell.org
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

Dear listers,

I was writing a program which defines a function named "show". But at each
of the recursive calls to itself "ghci" is showing the following message:
' Ambiguous occurrence `show'
    It could refer to either `show', defined at temp.hs:5:0
                          or `show', imported from Prelude         '

I don't want to import the 'show' function from prelude. Is there any way
out or I have to declare instance of the 'Show'?
Can we specify the module of a function from which it will be referred?

-- 
Amit kumar Dhar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20081014/13c01ec4/attachment-0001.htm

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

Message: 3
Date: Tue, 14 Oct 2008 09:46:26 +0200
From: Tillmann Rendel <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] Can we specify the module of the
        function        being   referred
To: Amit Kumar Dhar <[EMAIL PROTECTED]>
Cc: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Amit Kumar Dhar wrote:
> I don't want to import the 'show' function from prelude. Is there any way
> out or I have to declare instance of the 'Show'?

The prelude is only implicitly imported, if it is not explicitly 
imported. That means that you can explicitly say

   import Prelude hiding (show)

to get rid of Prelude's show.

> Can we specify the module of a function from which it will be referred?

You can give a module a name while importing it, and then use this name 
with a dot. For your situation, maybe the following two import 
statements make sense:

   -- bring everything except show into scope
   import Prelude hiding (show)

   -- make Prelude's show available as P.show
   import qualified Prelude as P

Now you can even use Prelude's show in the definition of your own show. 
Here is an example, showing lists with set notation:

   show :: [Int] -> String
   show xs = "{" ++ content ++ "}" where
     content = concat (intersperse ", " (map P.show xs))

(use "import Data.List" for intersperse).

> I was writing a program which defines a function named "show".

While it is not wrong to use a name from the Prelude for something else, 
it is often confusing, so I would consider using some other name 
(display, toString, prettyPrint, ...).

   Tillmann


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

Message: 4
Date: Tue, 14 Oct 2008 10:03:43 +0200
From: Tillmann Rendel <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] variables in haskell
To: "Matthew J. Williams" <[EMAIL PROTECTED]>
Cc: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Matthew J. Williams wrote:
> Hello listers, would one be correct in thinking that 'bound variables' 
> such as those used in haskell were in fact constants?

I think I see what you mean, but it is not entirely correct. A constant 
is something which has the same value at all times. For example, 
top-level declarations in most languages, including Haskell, can be seen 
as constants:

   foo = "hello world" -- this foo will always mean "hello world"

If the value associated with a name changes from time to time, then we 
call that name a variable.

   bar foo = ... -- foo will mean something else everytime bar is called

The behaviour of Haskell variables is similiar to "constant variables" 
or "final variables" in other languages, e.g. in Java

   public int bar(final int foo) {
   }

Similiar to the Haskell version, in this Java code, foo will be 
something different for each call of bar, but it will not change during 
one execution of bar. Your wouldn't call foo a constant here, would you?

   Tillmann


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

Message: 5
Date: Wed, 15 Oct 2008 06:52:29 +0100
From: "Matthew J. Williams" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] variables in haskell
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"; format=flowed


>>Hello listers, would one be correct in thinking that 'bound 
>>variables' such as those used in haskell were in fact constants?
>
>I think I see what you mean, but it is not entirely correct. A 
>constant is something which has the same value at all times. For 
>example, top-level declarations in most languages, including 
>Haskell, can be seen as constants:
>
>   foo = "hello world" -- this foo will always mean "hello world"
>
>If the value associated with a name changes from time to time, then 
>we call that name a variable.
>
>   bar foo = ... -- foo will mean something else everytime bar is called
>
>The behaviour of Haskell variables is similiar to "constant 
>variables" or "final variables" in other languages, e.g. in Java
>
>   public int bar(final int foo) {
>   }
>
>Similiar to the Haskell version, in this Java code, foo will be 
>something different for each call of bar, but it will not change 
>during one execution of bar. Your wouldn't call foo a constant here, would you?


         My recollection of 'final' in 'Java' is a little vague, 
nevertheless, in 'c/c++' the const keyword indicates that the 
associated function argument must be 'treated' as a constant. I am 
not convinced that the idea of a constant value is not being 
honored  in this situation. The function definition is after all a 
'pattern' (if I may be permitted to use the term in its most general sense):

         int f (const int x) {
                 return (x+1);
                 }

would be equivalent to the following:

         let f x = x+1

         In 'c/c++' a global constant would have very similar 
properties, in fact, exactly similar in so far as the 'immutability' 
of the value is concerned.

         Sincerely
         Matthew J. Williams 



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

Message: 6
Date: Wed, 15 Oct 2008 10:18:16 +0100 (GMT Daylight Time)
From: Philippa Cowderoy <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] variables in haskell
To: "Matthew J. Williams" <[EMAIL PROTECTED]>
Cc: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Mon, 13 Oct 2008, Matthew J. Williams wrote:

> Hello listers, would one be correct in thinking that 'bound variables' such as
> those used in haskell were in fact constants?
> 

Possibly the simplest explanation is that they're variables in the same 
sense variables in algebra are?

-- 
[EMAIL PROTECTED]

The task of the academic is not to scale great
intellectual mountains, but to flatten them.


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

Message: 7
Date: Wed, 15 Oct 2008 11:54:50 +0100
From: Paul Johnston <[EMAIL PROTECTED]>
Subject: [Haskell-beginners] Problems with ghc
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Apologies if this is not exactly what this list is for but is anyone 
running ghc on Solaris, specifically Open Solaris 5.11?

It seemed to work

[EMAIL PROTECTED]:~/haskell/aht/3$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.8.3
[EMAIL PROTECTED]:~/haskell/aht/3$ ghci
GHCi, version 6.8.3: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
Prelude>

And ghci works as expected but !!!

Trying to compile I get:

[EMAIL PROTECTED]:~/haskell/aht/3$ ghc -o Haq Haq.hs
compilation IS NOT required
Undefined            first referenced
 symbol                  in file
__gmpz_tdiv_q                       
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_tdiv_r                       
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpn_cmp                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_add                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_and                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_gcd                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_ior                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_com                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_mul                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_xor                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_sub                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpn_gcd_1                        
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_init                         
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_fdiv_qr                      
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmp_set_memory_functions          
/usr/local/lib/ghc-6.8.3/libHSrts.a(Storage.o)
__gmpz_divexact                     
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_tdiv_qr                      
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
ld: fatal: Symbol referencing errors. No output written to Haq
collect2: ld returned 1 exit status

I get this trying to build hmake with the new configure file supplied by 
Malcolm Wallace.
Once again sorry if its off topic but wondered if it's only me :-)

Cheers Paul





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

Message: 8
Date: Wed, 15 Oct 2008 13:04:41 +0200
From: Daniel Fischer <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] Problems with ghc
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;  charset="iso-8859-1"

Am Mittwoch, 15. Oktober 2008 12:54 schrieb Paul Johnston:
> Apologies if this is not exactly what this list is for but is anyone
> running ghc on Solaris, specifically Open Solaris 5.11?
>
> It seemed to work
>
> [EMAIL PROTECTED]:~/haskell/aht/3$ ghc --version
> The Glorious Glasgow Haskell Compilation System, version 6.8.3
> [EMAIL PROTECTED]:~/haskell/aht/3$ ghci
> GHCi, version 6.8.3: http://www.haskell.org/ghc/  :? for help
> Loading package base ... linking ... done.
> Prelude>
>
> And ghci works as expected but !!!
>
> Trying to compile I get:
>
> [EMAIL PROTECTED]:~/haskell/aht/3$ ghc -o Haq Haq.hs

Try

ghc -o Haq --make Haq.hs

or give the needed packages with the flag -package on the commandline.


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

Message: 9
Date: Wed, 15 Oct 2008 13:51:03 +0100
From: Paul Johnston <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] Problems with ghc
To: Daniel Fischer <[EMAIL PROTECTED]>
Cc: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Daniel Fischer wrote:
> Am Mittwoch, 15. Oktober 2008 12:54 schrieb Paul Johnston:
>   
>> Apologies if this is not exactly what this list is for but is anyone
>> running ghc on Solaris, specifically Open Solaris 5.11?
>>
>> It seemed to work
>>
>> [EMAIL PROTECTED]:~/haskell/aht/3$ ghc --version
>> The Glorious Glasgow Haskell Compilation System, version 6.8.3
>> [EMAIL PROTECTED]:~/haskell/aht/3$ ghci
>> GHCi, version 6.8.3: http://www.haskell.org/ghc/  :? for help
>> Loading package base ... linking ... done.
>> Prelude>
>>
>> And ghci works as expected but !!!
>>
>> Trying to compile I get:
>>
>> [EMAIL PROTECTED]:~/haskell/aht/3$ ghc -o Haq Haq.hs
>>     
>
> Try
>
> ghc -o Haq --make Haq.hs
>
> or give the needed packages with the flag -package on the commandline.
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>   
Many thanks but no joy see below
Think it could be gmp which I had to also compile but it passed all its 
checks.



[EMAIL PROTECTED]:~/haskell/aht/3$ ghc -o Haq 
--make Haq.hs
Linking Haq ...
Undefined                       first referenced
 symbol                             in file
__gmpz_tdiv_q                       
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_tdiv_r                       
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpn_cmp                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_add                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_and                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_gcd                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_ior                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_com                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_mul                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_xor                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_sub                          
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpn_gcd_1                        
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_init                         
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_fdiv_qr                      
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmp_set_memory_functions          
/usr/local/lib/ghc-6.8.3/libHSrts.a(Storage.o)
__gmpz_divexact                     
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
__gmpz_tdiv_qr                      
/usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o)
ld: fatal: Symbol referencing errors. No output written to Haq
collect2: ld returned 1 exit status

Regards Paul




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

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 4, Issue 4
***************************************

Reply via email to