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
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  gtk2hs [GIMP ToolKit] (aditya siram)
   2. Re:  gtk2hs [GIMP ToolKit] (Tim Baumgartner)
   3.  New to Haskell: constructing Data Types (Tyler Hayes)
   4. Re:  lazy IO by example (Dean Herington)
   5. Re:  New to Haskell: constructing Data Types (Lyndon Maydwell)
   6. Re:  New to Haskell: constructing Data Types (Antoine Latter)
   7. Re:  lazy IO by example (Tim Baumgartner)


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

Message: 1
Date: Fri, 4 Feb 2011 17:03:19 -0600
From: aditya siram <aditya.si...@gmail.com>
Subject: Re: [Haskell-beginners] gtk2hs [GIMP ToolKit]
To: Patrick Lynch <kmandpjly...@verizon.net>
Cc: beginners@haskell.org
Message-ID:
        <AANLkTinrmVURTykKGdHTXAA3w705zM=ffzi_0jxjy...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

This was hard for me on Windows too which is why I documented what I
did on the wiki. Please do let me know if the instructions are wrong.

@Tim : I found it best not to use the mingw binary that ships with
Haskell Platform but install it from scratch.

-deech

On Fri, Feb 4, 2011 at 1:23 PM, Patrick Lynch <kmandpjly...@verizon.net> wrote:
> Good moring,
> ...I know how hard it is...
> ...this will be my second attempt on a Windows Vista PC...I also have to
> install it on a Mac...
> ...I'll try it again this afternoon...
> Good luck to both of us
>
> It really shouldn't be this hard...bummer...
>
> ----- Original Message -----
> From: Tim Baumgartner
> To: beginners@haskell.org
> Cc: Patrick Lynch
> Sent: Friday, February 04, 2011 2:13 PM
> Subject: Re: [Haskell-beginners] gtk2hs [GIMP ToolKit]
> Hi Patrick,
>
> I used the same link to install gtk2hs on Windows XP with Haskell Platform
> 2010.2.0 about 3 days ago. I'm a beginner as well. I had a number of
> problems. In the end, I managed to install version 0.11 with some
> extra-work:
> - I added HaskellPlatform/2010.2.0.0/mingw/bin to the PATH (because there is
> my only current gcc.exe)
> - ugly: I copied Gtk+/include/glib-2.0 to a temp folder and copied this
> again *into* Gtk+/include/glib-2.0? (the output of pkg-config looked
> alright...)
> - I repeated the previous steps for other include folders as well
>
> Note: in order to install a specific version of a package you can e.g.
> cabal install gtk2hs-buildtools-0.11.2
>
> Installation of 0.12. failed with the following error:
> [ 5 of 24] Compiling System.GIO.Volumes.VolumeMonitor (
> dist\build\System\GIO\Volumes\VolumeMonitor.hs,
> dist\build\System\GIO\Volumes\VolumeMonitor.o )
>
> System\GIO\Volumes\VolumeMonitor.chs:56:4:
> ??? Not in scope: `vmDriveStopButton'
>
> Regards,
> Tim
>
>
> 2011/2/3 Patrick Lynch <kmandpjly...@verizon.net>
>>
>> ...I'm going to try to install gtk2hs again...
>> ...I'll be using the link http://www.haskell.org/haskellwiki/Gtk2Hs
>> ...I'd appreciate any help...
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners@haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>



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

Message: 2
Date: Sat, 5 Feb 2011 00:20:42 +0100
From: Tim Baumgartner <baumgartner....@googlemail.com>
Subject: Re: [Haskell-beginners] gtk2hs [GIMP ToolKit]
To: beginners@haskell.org
Message-ID:
        <aanlktikjhea5ogmkhwbhcmokjore_6ao6mw_6vstr...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

@Patrick the missing libraries problem seems to be something different. I
didn't run into this one.

Good luck!



2011/2/5 aditya siram <aditya.si...@gmail.com>

> This was hard for me on Windows too which is why I documented what I
> did on the wiki. Please do let me know if the instructions are wrong.
>
> @Tim : I found it best not to use the mingw binary that ships with
> Haskell Platform but install it from scratch.
>
> -deech
>

Ok, thanks deech, I will install a brand new mingw next time anything goes
wrong.

Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110205/e4782f3f/attachment-0001.htm>

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

Message: 3
Date: Fri, 04 Feb 2011 20:33:26 -0800
From: Tyler Hayes <t...@pdx.edu>
Subject: [Haskell-beginners] New to Haskell: constructing Data Types
To: beginners@haskell.org
Message-ID: <1296880406.1965.6.camel@Hodges>
Content-Type: text/plain; charset="UTF-8"

As an exercise, I'm attempting to create an abstract syntax tree for a
very small language:

data Expression = Variable String
                | Integer
                | Expression BinOp Expression
                deriving Show

data Statement = Assignment Variable Expression    --error!
               | If Expression Statement Statement
               | While Expression Statement
               | Compound Statement
               deriving Show

data BinOp = Add
           | Mult
           | LessThan
           | GreaterThan
           deriving Show

However, there is a problem with having "Variable" as an argument to the
"Assignment" constructor of the "Statement" data type:

Prelude> :l test.hs 
[1 of 1] Compiling Test              ( test.hs, interpreted )

test.hs:8:28: Not in scope: type constructor or class `Variable'
Failed, modules loaded: none.

An 'assignment' is a variable followed by an expression in this example,
so what can I do to fix this?

Thanks,
Tyler




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

Message: 4
Date: Fri, 4 Feb 2011 23:42:16 -0500
From: Dean Herington <heringtonla...@mindspring.com>
Subject: Re: [Haskell-beginners] lazy IO by example
To: Tim Baumgartner <baumgartner....@googlemail.com>,
        beginners@haskell.org
Message-ID: <a06240800c97284ab288e@[10.0.1.6]>
Content-Type: text/plain; charset="us-ascii"; Format="flowed"

At 1:29 PM +0100 2/4/11, Tim Baumgartner wrote:
>Hi community,
>
>In the following code, the main function only wants to print the 
>first 5 numbers of a huge list. But since the computation is not 
>lazy, this doesn't work in a satisfactory way.
>
>
>
>content :: Int -> IO [Int]
>content i = do
>   fs  <- files i
>   ds  <- directories i
>   fss <- mapM content ds
>   return $ fs ++ concat fss
>
>files i = return [1..i]
>
>
>directories i = return [1..i-1]
>
>main = content 1000000 >>= print . take 5
>
>
>Now I'd like to know if it's possible to make this "IO" lazy, using 
>unsafeInterleaveIO. I tried to do it, failed. Perhaps someone can 
>help.

In your simplified example, it suffices to wrap unsafeInterleaveIO 
around (mapM content ds).  In a more realistic case, you'd need to 
add some `unsafeInterleaveIO`s in `files` and `directories`, too.

Dean

P.S. You might also want to look into iteratees, which accomplish a 
similar goal in a more robust way.

>
>I guess another weakness of this code is the bad performance of "dfs 
>++ concat fss", but currently I don't care about that.
>
>Thanks for any help
>Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110204/70a63184/attachment-0001.htm>

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

Message: 5
Date: Sat, 5 Feb 2011 12:45:20 +0800
From: Lyndon Maydwell <maydw...@gmail.com>
Subject: Re: [Haskell-beginners] New to Haskell: constructing Data
        Types
To: Tyler Hayes <t...@pdx.edu>
Cc: beginners@haskell.org
Message-ID:
        <aanlktimstsjpxjeqqc0n0pdiv4ygyxozss3tlyufa...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Constructor definitions take type arguments but you have given it
another constructor. To fix this, you might want to create a Variable
datatype and reference it in the Expresion datatype and the Statement
datatype but it's hard (for me) to know without further information.

On Sat, Feb 5, 2011 at 12:33 PM, Tyler Hayes <t...@pdx.edu> wrote:
> As an exercise, I'm attempting to create an abstract syntax tree for a
> very small language:
>
> data Expression = Variable String
> ? ? ? ? ? ? ? ?| Integer
> ? ? ? ? ? ? ? ?| Expression BinOp Expression
> ? ? ? ? ? ? ? ?deriving Show
>
> data Statement = Assignment Variable Expression ? ?--error!
> ? ? ? ? ? ? ? | If Expression Statement Statement
> ? ? ? ? ? ? ? | While Expression Statement
> ? ? ? ? ? ? ? | Compound Statement
> ? ? ? ? ? ? ? deriving Show
>
> data BinOp = Add
> ? ? ? ? ? | Mult
> ? ? ? ? ? | LessThan
> ? ? ? ? ? | GreaterThan
> ? ? ? ? ? deriving Show
>
> However, there is a problem with having "Variable" as an argument to the
> "Assignment" constructor of the "Statement" data type:
>
> Prelude> :l test.hs
> [1 of 1] Compiling Test ? ? ? ? ? ? ?( test.hs, interpreted )
>
> test.hs:8:28: Not in scope: type constructor or class `Variable'
> Failed, modules loaded: none.
>
> An 'assignment' is a variable followed by an expression in this example,
> so what can I do to fix this?
>
> Thanks,
> Tyler
>
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



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

Message: 6
Date: Fri, 4 Feb 2011 22:46:49 -0600
From: Antoine Latter <aslat...@gmail.com>
Subject: Re: [Haskell-beginners] New to Haskell: constructing Data
        Types
To: Tyler Hayes <t...@pdx.edu>
Cc: beginners@haskell.org
Message-ID:
        <AANLkTikOJ7e0znoJ7wcfRvq2ri=xrpvd2wtwx5v-k...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On Fri, Feb 4, 2011 at 10:33 PM, Tyler Hayes <t...@pdx.edu> wrote:
> As an exercise, I'm attempting to create an abstract syntax tree for a
> very small language:
>
> data Expression = Variable String
> ? ? ? ? ? ? ? ?| Integer
> ? ? ? ? ? ? ? ?| Expression BinOp Expression
> ? ? ? ? ? ? ? ?deriving Show
>
> data Statement = Assignment Variable Expression ? ?--error!
> ? ? ? ? ? ? ? | If Expression Statement Statement
> ? ? ? ? ? ? ? | While Expression Statement
> ? ? ? ? ? ? ? | Compound Statement
> ? ? ? ? ? ? ? deriving Show
>
> data BinOp = Add
> ? ? ? ? ? | Mult
> ? ? ? ? ? | LessThan
> ? ? ? ? ? | GreaterThan
> ? ? ? ? ? deriving Show
>
> However, there is a problem with having "Variable" as an argument to the
> "Assignment" constructor of the "Statement" data type:
>

In your example, you've declared three types: Expression, Statement
and BinOp. So when you ask for a type named 'Variable' it can't find
one. Perhaps you meant 'String' ?

In your above example, you do have a data constrictor 'Variable',
which can be used as a value to construct values of type 'Expression'
(or in a pattern match over values of type Expression).

The difference between types and data constructors can be tricky at
first, especially since they appear with each other in code and have
similar naming conventions.

If I'm speaking a foreign language I can probably dig up a tutorial to
point you to :-)

Antoine



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

Message: 7
Date: Sat, 5 Feb 2011 11:01:23 +0100
From: Tim Baumgartner <baumgartner....@googlemail.com>
Subject: Re: [Haskell-beginners] lazy IO by example
To: Dean Herington <heringtonla...@mindspring.com>,
        beginners@haskell.org
Message-ID:
        <AANLkTim-Di79uu4trW1-LTVSrhw=wtrrzqtwpnahe...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

2011/2/5 Dean Herington <heringtonla...@mindspring.com>

> In your simplified example, it suffices to wrap unsafeInterleaveIO around
> (mapM content ds).  In a more realistic case, you'd need to add some
> `unsafeInterleaveIO`s in `files` and `directories`, too.
>

Thanks a lot! Now it was easy to write a lazy findFiles.
Would one have to write down a lot in order to see "on paper" why the
original example was not lazy? If I coud do this, I might run into fewer
problems in the future.



> Dean
>
> P.S. You might also want to look into iteratees, which accomplish a similar
> goal in a more robust way.
>

Yes, I already looked over the article in Monad reader #16. But then I
thaught I will first gain more understanding of the traditional way and then
return to iteratees.


Regards
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110205/e570f2a7/attachment-0001.htm>

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

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


End of Beginners Digest, Vol 32, Issue 13
*****************************************

Reply via email to