Simon Marlow | 1 Apr 2008 01:16
Picon

Re: 64-bit breakdown

Jay Scott wrote:
> I have a MacBook (which is a Core 2 Duo) running Mac OS X 10.4. On this
> platform, gcc makes 32-bit executables by default, but if you give it -
> m64 it makes them 64-bit. I've tried it, and it works. gcc gives its
> version as "i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer,
> Inc. build 5367)"
> 
> But 64-bit doesn't work with my ghc installation (6.8.2 from the binary
> distribution on the downloads page). If I compile a "Hello World"
> program with -fvia-c -optc-m64, it fails, saying
> 
> --
> Warning: retaining unknown function `_siC_entry.eh' in output from C compiler
> Warning: retaining unknown function `_Main_main_entry.eh' in output from
> C compiler
> Warning: retaining unknown function `_ZCMain_main_entry.eh' in output
> from C compiler
> Prologue junk?: _siC_entry:
> LFB142:
>         subq    $8, %rsp
> LCFI0:
> --
> 
> I don't need to solve this, but I thought I should make sure it's known.

GHC is built up front to generate either 32-bit or 64-bit code, there's 
no way to change this for a given GHC build.  You should be able to 
install two versions of GHC side-by-side, but if you need to pass -m64 
to gcc to get it to generate 64-bit code, then you will need to invoke 
ghc with something like
(Continue reading)

Christian Maeder | 1 Apr 2008 11:10
Picon
Favicon

Re: patch-applied messages

Christian Maeder wrote:
> could the actual change-diff of patches also be posted via
> the list cvs-ghc <at> haskell.org

I just see that patches sent to cabal-devel <at> haskell.org have a link to
the actual patch. I.e.

View patch online:
http://darcs.haskell.org/cabal-install/_darcs/patches/20080329194426-adfee-0e5c64288be06f7f0d81af18fcec9eee83ef00d5.gz

Could such links also be added to cvs-ghc <at> haskell.org messages?

Thanks Christian
Simon Peyton-Jones | 1 Apr 2008 13:21
Picon
Favicon
Gravatar

RE: simple CSE?

Not reliably, no.  GHC’s current CSE is rather opportunistic: we take the opportunity if it’s presented in the form

let x = e in let y = e in ....

 

A proper CSE pass would be a nice, containable, project.

 

Simon

 

From: glasgow-haskell-users-bounces <at> haskell.org [mailto:glasgow-haskell-users-bounces <at> haskell.org] On Behalf Of Conal Elliott
Sent: 29 March 2008 01:53
To: glasgow-haskell-users <at> haskell.org
Subject: simple CSE?

 

I'd like to know if it's possible to get GHC to perform some simple CSE for function-level programming.  Here's a simple example:

    liftA2 (*) sin sin :: Double -> Double

which inlines and simplifies to

  \ t -> sin t * sin t

A more realistic, equivalent, example:

    let b = sin <$> id in liftA2 (*) b b

Can GHC be nudged into computing 'sin t' once rather than twice?

Thanks,  - Conal

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Cristian Perfumo | 1 Apr 2008 17:03
Picon

Re: ANN: prof2dot, a graphical profiling tool

I was wondering if it handles per-thread information when you have more than one thread involved. (Actually the question is not related to the graphical tool, but the announcement triggered it).
Best.
Cristian

2008/3/8 Gregory Wright <gwright <at> comcast.net>:


I am pleased to announce the first release of prof2dot, a graphical profiling tool
for use with GHC.

While GHC has in the past worked with graphical profiling tools, they 
have been heavyweight and/or proprietary.  Prof2dot is a simple tool for
converting profiling information into a graphical format, released under a BSD3
license.  It is simple because it offloads all of the work of rendering the graph
onto Graphviz.  So you need to install the Graphviz tools in order to use it.

The program is a filter that takes the profiling output generated by running
a GHC-compiled program with the "+RTS -px -RTS" option and turns it into
a dot file.  (The "dot" format is a textual representation of a directed or undirected graph.)
The dot file can rendered in any format supported by Graphviz's
dot program, and the file itself can be post-processed or edited to adjust the
layout.

Features of prof2dot:

* display either the call graph (default) or the call tree,

* colorize by cost center count, time or allocations,

* group cost centers in the same module.

Prof2dot installs as a typical caballized application.
Running "prof2dot -?" from the command line will give a short summary of
how to use the program and its options.

Rendering very large graphs can exceed the internal resource limits of dot.
You may have to compile your own version of the Graphviz tools with higher limits
to handle these cases.

A example of a colorized profile of a medium sized project is shown on our
company's web site: http://antiope.com/downloads.html.  Click on the small
image to download a pdf of the complete profile graph.

Prof2dot is available from hackage or the link given above.


-Greg

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Joachim Breitner | 1 Apr 2008 18:30
Picon
Favicon
Gravatar

ghc fails to find the right instance

Hi,

I was told on #haskell that I should bring this up here, to ask whether
this is a bug in ghc6 or otherwise explain this to me.

I’m trying to write the function "addd" which takes an arbitrary number
of Integer arguments and returns the sum. This code works:

-- Try 1
class More a where
        more ::Integer -> a

instance (More a, Integral i) => More (i -> a) where
	more v1 v2 = more (v1 + toInteger v2)
instance More Integer where
	more v = v

addd :: More a => a
addd = more 0

printI :: Integer -> IO ()
printI = print

main = do
        printI $ addd
        printI $ addd 1 
        printI $ addd 1 2
        printI $ addd 1 2 3
-- SNIP

But when I try to use a concret type (Integer) instead of the (Integral
i =>) condition (which should make the program more concrete, I’d say)
and write the following instance:

-- Try 2 (changed lines of code)
instance More a => More (Integer -> a) where
        more v1 v2 = more (v1 + v2)
-- SNIP

I get this error:
test.hs:4:0:
    Illegal instance declaration for `More (Integer -> a)'
        (All instance types must be of the form (T a1 ... an)
         where a1 ... an are distinct type *variables*
         Use -XFlexibleInstances if you want to disable this.)
    In the instance declaration for `More (Integer -> a)'
Failed, modules loaded: none.

Well, I add {-# LANGUAGE FlexibleInstances #-} and get this error for
the line "printI $ addd 1" (and similar errors for the other following
addd lines):

test.hs:19:17:
    No instance for (More (t -> Integer))
      arising from a use of `addd' at test.hs:19:17-22
    Possible fix: add an instance declaration for (More (t -> Integer))
    In the second argument of `($)', namely `addd 1'
    In the expression: printI $ addd 1
    In a 'do' expression: printI $ addd 1

And this is the point where I’m lost and would like to ask for hints
what this means.

Thanks,
Joachim

--

-- 
Joachim "nomeata" Breitner
  mail: mail <at> joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
  JID: nomeata <at> joachim-breitner.de | http://www.joachim-breitner.de/
  Debian Developer: nomeata <at> debian.org
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Claus Reinke | 1 Apr 2008 18:53

Re: ghc fails to find the right instance

'Integer -> a'  is more concrete, less general than 'i -> a',
so it matches fewer types.

'1 :: Num a => a' is more general than 'Integer'.

|    No instance for (More (t -> Integer))
|      arising from a use of `addd' at test.hs:19:17-22

if nothing forces the parameter (!) to be Integer, the
more concrete instance won't match. try type-annotating
the numeric literals.

claus
Joachim Breitner | 1 Apr 2008 19:12
Picon
Favicon
Gravatar

Re: ghc fails to find the right instance

Hi,

Am Dienstag, den 01.04.2008, 17:53 +0100 schrieb Claus Reinke:
> 'Integer -> a'  is more concrete, less general than 'i -> a',
> so it matches fewer types.
> 
> '1 :: Num a => a' is more general than 'Integer'.
> 
> |    No instance for (More (t -> Integer))
> |      arising from a use of `addd' at test.hs:19:17-22
> 
> if nothing forces the parameter (!) to be Integer, the
> more concrete instance won't match. try type-annotating
> the numeric literals.

Indeed,
printI $ addd (1::Int) (2::Int) (3::Int)
does work.

But I can’t follow your explanation completely. When I use the variant
with Integer, ghc will not use the instance because (1::Num a => a) is
too general.

But why does it use the Integral i-Instance in the working variant?
(1::Num a=> a) is also more general than (1::Integral i => i), isn’t it?

Thanks,
Joachim

--

-- 
Joachim "nomeata" Breitner
  mail: mail <at> joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
  JID: nomeata <at> joachim-breitner.de | http://www.joachim-breitner.de/
  Debian Developer: nomeata <at> debian.org
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Claus Reinke | 1 Apr 2008 21:11

Re: ghc fails to find the right instance

|But I can’t follow your explanation completely. When I use the variant
|with Integer, ghc will not use the instance because (1::Num a => a) is
|too general.
|
|But why does it use the Integral i-Instance in the working variant?
|(1::Num a=> a) is also more general than (1::Integral i => i), isn’t it?

because instance selection does not take instance contexts
into account (a frequent source of feature requests;-):

http://www.haskell.org/ghc/docs/latest/html/users_guide/type-class-extensions.html#instance-overlap

so, the match is against 'i', and the 'Integral i' is added
to the constraints needing proof *after* that instance
has been chosen.

claus
Gregory Wright | 2 Apr 2008 08:17
Picon

Re: ANN: prof2dot, a graphical profiling tool


Hi Cristian,

On Apr 1, 2008, at 11:03 AM, Cristian Perfumo wrote:

I was wondering if it handles per-thread information when you have more than one thread involved. (Actually the question is not related to the graphical tool, but the announcement triggered it).

The prof2dot tool only knows about the information that is in the profiling dump file.  IIRC,
cost centers are not associated with threads in this file.  (The format isn't documented, but
it is not hard to figure out, given a look at the code that generates it.)

Is recording the thread in which a cost was incurred really helpful?  If it is, I could look into
adding it.  But are you more interested in a graphical representation of thread execution ---
which threads are executing and when?  You should check if any of the old
Glasgow Parallel Haskell tools are close to what you want.  If so, it might be less
work to resurrect one of those.

Best Wishes,
Greg
 

Best.
Cristian

2008/3/8 Gregory Wright <gwright <at> comcast.net>:


I am pleased to announce the first release of prof2dot, a graphical profiling tool
for use with GHC.


_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Patrick Surry | 2 Apr 2008 22:26

Confused about typing in ghci

I'm new to Haskell and functional programming; have been exploring the fixed-point combinator based on the exercise in the HSOE book.  Having an odd issue with typing in ghci which I don't understand - maybe it's to do with section 3.4.5. "Type defaulting in GHCi" but I don't really grok that yet…

 

(BTW, an unrelated question:  is there a good reference where I can understand the precendence/associativity rules for Haskell?  I continually find myself needing lots of parens before expressions behave as I expect, and get very confused trying to use the $ operator - usually resorting to lots of parens again :-)

 

My typing question might boil down to this simple example, though my original example follows:

 

-- Why don't these (particularly g and g') all have the same type?

 

Prelude> :t (\x -> x+1)

(\x -> x+1) :: (Num a) => a -> a

Prelude> let g = (\x -> x+1)

Prelude> :t g

g :: Integer -> Integer

Prelude> let g' x = x + 1

Prelude> :t g'

g' :: (Num a) => a -> a

 

-- Here's my original fixed-point combinator example:

 

Prelude> let fix f = f (fix f)

 

-- here's a silly (but working) implementation of length using fix:

 

Prelude>  fix (\g xs -> if xs == [] then 0 else (1 + g (tail xs))) [1,2,3,4]

4

 

-- so I examine the types of the parts, which seems fine:

 

Prelude> :t fix (\g xs -> if xs == [] then 0 else (1 + g (tail xs)))

…  :: (Num t, Eq a) => [a] -> t

 

Prelude> :t (\g xs -> if xs == [] then 0 else (1 + g (tail xs)))

… :: (Num t, Eq a) => ([a] -> t) -> [a] -> t

 

-- but now I try to bind the anonymous function to a name

-- this seems to get the types wrong and no longer works as I expect:

 

Prelude> let lenstep = (\g xs -> if xs == [] then 0 else (1 + g (tail xs)))

Prelude> :t lenstep

lenstep :: ([()] -> Integer) -> [()] -> Integer

Prelude> :t fix lenstep

fix lenstep :: [()] -> Integer

Prelude> let len' = fix (\g xs -> if xs == [] then 0 else (1 + g (tail xs)))

Prelude> :t len'

len' :: [()] -> Integer

Prelude>

Prelude> len' [1,2,3,4]

<interactive>:1:12:

    No instance for (Num ())

      arising from the literal `4' at <interactive>:1:12

    Possible fix: add an instance declaration for (Num ())

    In the expression: 4

    In the first argument of `len'', namely `[1, 2, 3, 4]'

    In the expression: len' [1, 2, 3, 4]

 

-- maybe this is just me not understanding name binding properly; it seems to work if I do it this way:

 

Prelude> let lenstep' g xs = (if xs == [] then 0 else (1 + g (tail xs)))

Prelude> :t lenstep'

lenstep' :: (Eq a, Num t) => ([a] -> t) -> [a] -> t

Prelude> :t fix lenstep'

fix lenstep' :: (Eq a, Num t) => [a] -> t

Prelude> fix lenstep' [1,2,3,4]

4

 

-- but what's the difference?

 

Cheers,

Patrick

 

 

Tel: (617) 457 5230 Mob: (857) 919 1700 Fax: (617) 457 5299 Map

 

Portrait Software introduces Portrait Campaign Manager:

Easy, integrated campaign management for automated and highly targeted outbound marketing

 


________________________________________________________________________
DISCLAIMER: This e-mail is intended only for the addressee named above. As this e-mail may contain confidential or privileged information, if you are not the named addressee, you are not authorised to retain, read, copy or disseminate this message or any part of it. If you received this email in error, please notify the sender and delete the message from your computer.
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Gmane