Send Beginners mailing list submissions to
        [email protected]

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:  "stage restriction" when using Data.Heap (Brent Yorgey)
   2. Re:  "stage restriction" when using Data.Heap (Daniel Fischer)
   3.  hsmagic & core dump (Sergey Bushnyak)


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

Message: 1
Date: Tue, 8 Jan 2013 12:02:45 -0500
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] "stage restriction" when using
        Data.Heap
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Tue, Jan 08, 2013 at 07:03:20AM +0100, Martin Drautzburg wrote:
> When I :load this into ghci
> 
> import Data.Heap 
> 
> heap = empty :: MinHeap (Int,String)
> insert (1,"kjh") heap
> 
> I get 
> 
>     GHC stage restriction: `heap'
>       is used in a top-level splice or annotation,
>       and must be imported, not defined locally
>     In the second argument of `insert', namely `heap'
>     In the expression: insert (1, "kjh") heap
> 
> But when I type in 
> 
> import Data.Heap 
> 
> let heap = empty :: MinHeap (Int,String)
> insert (1,"kjh") heap
> 
> everything works and I get
> 
>  fromList [(1,"kjh")]
> 
> Why is that so and what can I do to prevent the "stage restriction"?

Twan's analysis is correct.  But wow, that's a horrible error
message.  Do you by any chance have the TemplateHaskell extension
enabled (either with {-# LANGUAGE TemplateHaskell #-} at the top or
your file, or with :set -XTemplateHaskell in a .ghci file, or anything
like that)?  If not this should really be filed as a bug, GHC has no
business giving TH-related error messages without TH being turned on.

-Brent



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

Message: 2
Date: Tue, 08 Jan 2013 18:40:27 +0100
From: Daniel Fischer <[email protected]>
Subject: Re: [Haskell-beginners] "stage restriction" when using
        Data.Heap
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

On Tuesday 08 January 2013, 12:02:45, Brent Yorgey wrote:
> Twan's analysis is correct.  But wow, that's a horrible error
> message.  Do you by any chance have the TemplateHaskell extension
> enabled (either with {-# LANGUAGE TemplateHaskell #-} at the top or
> your file, or with :set -XTemplateHaskell in a .ghci file, or anything
> like that)?

Must be:

module Naked where

start :: Int
start = 13

start + 5

======

$ ghci Naked
GHCi, version 7.6.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Naked            ( Naked.hs, interpreted )

Naked.hs:6:1: Parse error: naked expression at top level
Failed, modules loaded: none.

======

$ ghci -XTemplateHaskell Naked
GHCi, version 7.6.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Naked            ( Naked.hs, interpreted )

Naked.hs:6:1:
    GHC stage restriction:
      `start' is used in a top-level splice or annotation,
      and must be imported, not defined locally
    In the first argument of `(+)', namely `start'
    In the expression: start + 5
Failed, modules loaded: none.

The message without TH is clear and good.

> If not this should really be filed as a bug, GHC has no
> business giving TH-related error messages without TH being turned on.
> 
> -Brent



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

Message: 3
Date: Wed, 09 Jan 2013 11:51:20 +0200
From: Sergey Bushnyak <[email protected]>
Subject: [Haskell-beginners] hsmagic & core dump
To: "[email protected]" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Trying to work with images via hsmagic package, use something like this

scaleTest :: FilePath -> IO()
scaleTest dst = do
                initializeMagick
                image <- readImage dst
                let image' =  scaleImage 450 450 image
                writeImage dst image'

but get core dump, when compiling. Types are ok, and path are valid, can 
it be problem of os or I'm doing something wrong?



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

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 55, Issue 8
****************************************

Reply via email to