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:  A "show" error (Adrien Haxaire)
   2. Re:  A "show" error (Adrien Haxaire)
   3. Re:  A "show" error (Brandon Allbery)
   4. Re:  A "show" error (Adrien Haxaire)
   5. Re:  A "show" error (bahad?r altan)
   6. Re:  A "show" error (Brandon Allbery)
   7.  populating a bloom filter; stymied by ST monad (Joey Hess)


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

Message: 1
Date: Sun, 11 Mar 2012 20:26:54 +0100
From: Adrien Haxaire <adr...@haxaire.org>
Subject: Re: [Haskell-beginners] A "show" error
To: beginners@haskell.org
Message-ID: <20120311192654.GA4231@arch>
Content-Type: text/plain; charset=iso-8859-1

On Sun, Mar 11, 2012 at 07:10:28PM +0000, bahad?r altan wrote:
> Hi,?
> I'm trying to process on a tree with this function :
> 
> f (Branch x (Branch y y1 y2) (Branch z z1 z2)) = (x,y,y1,y2,z,z1,z2)
> 
> 
> and my tree declaration is this :?
> 
> data Tree = Empty | Branch Integer Tree Tree deriving (Show)
> 
> And I'm getting this error :?
> 
> Main> f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
> ERROR - Cannot find "show" function for:
> *** Expression : f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
> *** Of type ? ?: (Integer,Integer,Tree,Tree,Integer,Tree,Tree)
> 
> I'll be happy if you help me to get rid of this error..

Hello,

Dit you try to derive it automatically, by adding 'deriving (Show)' after its 
declaration?

Otherwise you need to define it manually I'm afraid.

-- 
Adrien Haxaire 
www.adrienhaxaire.org | @adrienhaxaire



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

Message: 2
Date: Sun, 11 Mar 2012 20:34:13 +0100
From: Adrien Haxaire <adr...@haxaire.org>
Subject: Re: [Haskell-beginners] A "show" error
To: beginners@haskell.org
Message-ID: <20120311193413.GB4231@arch>
Content-Type: text/plain; charset=iso-8859-1

Oh sorry I just realized you did !



On Sun, Mar 11, 2012 at 07:10:28PM +0000, bahad?r altan wrote:
> Hi,?
> I'm trying to process on a tree with this function :
> 
> f (Branch x (Branch y y1 y2) (Branch z z1 z2)) = (x,y,y1,y2,z,z1,z2)
> 
> 
> and my tree declaration is this :?
> 
> data Tree = Empty | Branch Integer Tree Tree deriving (Show)
> 
> And I'm getting this error :?
> 
> Main> f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
> ERROR - Cannot find "show" function for:
> *** Expression : f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
> *** Of type ? ?: (Integer,Integer,Tree,Tree,Integer,Tree,Tree)
> 
> I'll be happy if you help me to get rid of this error..

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


-- 
Adrien Haxaire 
www.adrienhaxaire.org | @adrienhaxaire



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

Message: 3
Date: Sun, 11 Mar 2012 15:42:29 -0400
From: Brandon Allbery <allber...@gmail.com>
Subject: Re: [Haskell-beginners] A "show" error
To: bahad?r altan <doal...@yahoo.co.uk>
Cc: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <cakfcl4x7o7u8kdgq6erlm0tee4oynmnt3nqqsqccvvq+23a...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Sun, Mar 11, 2012 at 15:10, bahad?r altan <doal...@yahoo.co.uk> wrote:

> ERROR - Cannot find "show" function for:
> *** Expression : f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty
> Empty))
> *** Of type    : (Integer,Integer,Tree,Tree,Integer,Tree,Tree)
>

Hugs apparently doesn't have a Show instance for 7-tuples.

Note that Hugs is quite old and not very well supported at this point; you
should probably be using ghc / ghci instead.

-- 
brandon s allbery                                      allber...@gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20120311/1d42d4ce/attachment.html>

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

Message: 4
Date: Sun, 11 Mar 2012 20:43:13 +0100
From: Adrien Haxaire <adr...@haxaire.org>
Subject: Re: [Haskell-beginners] A "show" error
To: beginners@haskell.org
Message-ID: <20120311194313.GC4231@arch>
Content-Type: text/plain; charset=us-ascii

On Sun, Mar 11, 2012 at 07:26:02PM +0000, Ozgur Akgun wrote:
> Hi again,
> 
> What interpreter do you use? With ghci, I don't get any errors.
> 
> *Main> f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
> (12,15,Empty,Empty,28,Empty,Empty)
> 

Hi,

Me neither, no error on GHCi 7.4.1 on ArchLinux.

Prelude> data Tree = Empty | Branch Integer Tree Tree deriving (Show)
Prelude> let f (Branch x (Branch y y1 y2) (Branch z z1 z2)) = 
(x,y,y1,y2,z,z1,z2)
Prelude> f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
(12,15,Empty,Empty,28,Empty,Empty)

HTH,
Adrien


-- 
Adrien Haxaire 
www.adrienhaxaire.org | @adrienhaxaire



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

Message: 5
Date: Sun, 11 Mar 2012 20:00:34 +0000 (GMT)
From: bahad?r altan <doal...@yahoo.co.uk>
Subject: Re: [Haskell-beginners] A "show" error
To: Ozgur Akgun <ozgurak...@gmail.com>
Cc: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <1331496034.36410.yahoomail...@web171604.mail.ir2.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"

I use Hugs. ?And I must use it...


________________________________
 From: Ozgur Akgun <ozgurak...@gmail.com>
To: bahad?r altan <doal...@yahoo.co.uk> 
Cc: "beginners@haskell.org" <beginners@haskell.org> 
Sent: Sunday, 11 March 2012, 21:26
Subject: Re: [Haskell-beginners] A "show" error
 

Hi again,

What interpreter do you use? With ghci, I don't get any errors.

*Main> f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
(12,15,Empty,Empty,28,Empty,Empty)

On 11 March 2012 19:10, bahad?r altan <doal...@yahoo.co.uk> wrote:

Hi,?
>I'm trying to process on a tree with this function :
>
>
>f (Branch x (Branch y y1 y2) (Branch z z1 z2)) = (x,y,y1,y2,z,z1,z2)
>
>
>
>and my tree declaration is this :?
>
>
>data Tree = Empty | Branch Integer Tree Tree deriving (Show)
>
>
>And I'm getting this error :?
>
>
>Main> f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
>ERROR - Cannot find "show" function for:
>*** Expression : f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
>*** Of type ? ?: (Integer,Integer,Tree,Tree,Integer,Tree,Tree)
>
>
>I'll be happy if you help me to get rid of this error..
-- 
Ozgur Akgun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20120311/9224ef16/attachment-0001.htm>

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

Message: 6
Date: Sun, 11 Mar 2012 21:20:49 -0400
From: Brandon Allbery <allber...@gmail.com>
Subject: Re: [Haskell-beginners] A "show" error
To: bahad?r altan <doal...@yahoo.co.uk>
Cc: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <CAKFCL4WB=aicgyrxlfhzwqekavgsupzfmxhzdgz9ylbqgrq...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Sun, Mar 11, 2012 at 16:00, bahad?r altan <doal...@yahoo.co.uk> wrote:

> I use Hugs.  And I must use it...
>

That's ... unfortunate.  Use smaller tuples, then; I believe 6 is the limit
for its Show and Read instances.  Or define your own result ADT and derive
a Show instance for it.

-- 
brandon s allbery                                      allber...@gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20120311/e8985dda/attachment-0001.htm>

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

Message: 7
Date: Mon, 12 Mar 2012 02:38:45 -0400
From: Joey Hess <j...@kitenet.net>
Subject: [Haskell-beginners] populating a bloom filter; stymied by ST
        monad
To: beginners@haskell.org
Message-ID: <20120312063845.ga4...@gnu.kitenet.net>
Content-Type: text/plain; charset="us-ascii"

I have a potentially very large number of values to feed into a bloom
filter. They're coming from IO:

getValues :: (v -> k -> k) -> k -> IO k
getValues update initial = go initial =<< gen
        where
                go v [] = return v
                go v (f:fs) = do
                        x <- val f
                        go (maybe v (`update` v) x) fs
                gen = undefined
                val f = undefined

This streams lazily, but if I build a list (getValues (:) []),
the laziness is lost; the whole list is constructed and returned
before any of it can be used. Which uses too much memory of course.
So I can't use Data.BloomFilter.fromListB.

Seems I need to do something like this:

let filter = newMB (cheapHashes 13) 33554432 --- sized for 1 million items
filter' <- unsafeFreezeMB <$> getValues insertMB filter

Except this won't work, the mutable bloom filter uses the ST monad.
And I cannot see a way to combine the three "MB" functions into a
single computation in the same ST monad.

Perhaps stToIO to is what I need, but I can't work out how to use it.

Help?

-- 
see shy jo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20120312/445439d8/attachment-0001.pgp>

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

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


End of Beginners Digest, Vol 45, Issue 16
*****************************************

Reply via email to