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.  Different behaviors between GHC 7.6.3 and 7.8.3
      (Emilio De Camargo Francesquini)
   2.  How to pass configuration to a function further  down the
      call stack? (Thomas Koch)
   3. Re:  How to pass configuration to a function further down the
      call stack? (Christopher Allen)
   4. Re:  Different behaviors between GHC 7.6.3 and    7.8.3 (Hamid)
   5.  Connecting telnet connection to a wx widget (Tilmann)


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

Message: 1
Date: Tue, 30 Sep 2014 12:33:51 -0300
From: Emilio De Camargo Francesquini <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Different behaviors between GHC 7.6.3 and
        7.8.3
Message-ID:
        <cann71n6u8+ptzinrg-twx7z2n5wqybe9r393sss0rgy_zfc...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hello everyone,

I'm quite intrigued about these different behaviors between GHCs 7.6.3 and
7.8.3:


GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> let x = 3 + 4
Prelude> :print x
x = (_t1::Integer)
Prelude> :force x
x = 7
Prelude> print _t1
7
Prelude>


GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> let x = 3 + 4
Prelude> :print x
x = (_t1::Num a => a)
Prelude> :force x
x = _
Prelude> print _t1
ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.3 for x86_64-unknown-linux):
    tcTyVarDetails a{tv atm} [tv]

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug


Is it really a bug or is it something I really shouldn't be doing? I've
found this (fixed) bug (https://ghc.haskell.org/trac/ghc/ticket/8557), with
a similar error output, but it does not seem to be the same case.

Thanks

Emilio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140930/dc8c4ba3/attachment-0001.html>

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

Message: 2
Date: Tue, 30 Sep 2014 22:15:57 +0200
From: Thomas Koch <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] How to pass configuration to a function
        further down the call stack?
Message-ID: <[email protected]>
Content-Type: text/plain;  charset="us-ascii"

Hi,

I wrote my first Haskell 'project', a test suite for my personal SIEVE mail 
filter script using dovecots 'sieve-test' tool:

https://github.com/thkoch2001/sieve-test-hs

The file Network/Sieve/Test.hs might actually be interesting as a standalone 
library. The most important function is

assertMailActions :: Mail -> Actions -> IO ()

'Actions' is a type that describes the result of running a SIEVE filter over 
the passed mail, e.g. store in a certain folder, discard, reject, ...

Somewhere the external process 'sieve-test' is called. At this point I'd like 
to make certain things configurable:

- the path and name of the executable
- the parameters for the test-sieve executable
- the name of the sieve script
- the place where to store the temporary mail files
- whether or not to remove the temporary mail files

Does anybody has an idea where I could start to look for a solution?

Thank you,

Thomas Koch


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

Message: 3
Date: Tue, 30 Sep 2014 16:23:58 -0500
From: Christopher Allen <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How to pass configuration to a
        function further down the call stack?
Message-ID:
        <CADnndOo4+Kkh=whwg7ah_jscng7zo8shffu5lgrxc3oz-9e...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

First, define a datatype unifying all this config information.

Then there are two simple, common solutions.

If only one or two functions need to be passed the Config data, then just
pass it as an argument. If use of the config data is going to be prolific,
you might want to consider Reader.

http://stackoverflow.com/questions/14178889/reader-monad-purpose
http://book.realworldhaskell.org/read/programming-with-monads.html
https://hackage.haskell.org/package/transformers-0.4.1.0/docs/Control-Monad-Trans-Reader.html

You could engage in deeper magic than this, but it's not worth it for your
use-case.

Hope this helps.

-- Chris


On Tue, Sep 30, 2014 at 3:15 PM, Thomas Koch <[email protected]> wrote:

> Hi,
>
> I wrote my first Haskell 'project', a test suite for my personal SIEVE mail
> filter script using dovecots 'sieve-test' tool:
>
> https://github.com/thkoch2001/sieve-test-hs
>
> The file Network/Sieve/Test.hs might actually be interesting as a
> standalone
> library. The most important function is
>
> assertMailActions :: Mail -> Actions -> IO ()
>
> 'Actions' is a type that describes the result of running a SIEVE filter
> over
> the passed mail, e.g. store in a certain folder, discard, reject, ...
>
> Somewhere the external process 'sieve-test' is called. At this point I'd
> like
> to make certain things configurable:
>
> - the path and name of the executable
> - the parameters for the test-sieve executable
> - the name of the sieve script
> - the place where to store the temporary mail files
> - whether or not to remove the temporary mail files
>
> Does anybody has an idea where I could start to look for a solution?
>
> Thank you,
>
> Thomas Koch
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140930/cdc97e05/attachment-0001.html>

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

Message: 4
Date: Wed, 1 Oct 2014 09:58:09 +0330
From: Hamid <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Different behaviors between GHC 7.6.3
        and     7.8.3
Message-ID:
        <CABS9=uy9kv9smzh-3qmicggrb7aqdz4b-qp_2ggoyzciour...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Testing on 7.8.2:

GHCi, version 7.8.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude>  let x = 3 + 4
Prelude> :print x
x = (_t1::Num a => a)
Prelude> :force x
x = _
Prelude> :print _t1
_t1 = (_t2::Num a => a)
Prelude>


On Tue, Sep 30, 2014 at 7:03 PM, Emilio De Camargo Francesquini <
[email protected]> wrote:

> Hello everyone,
>
> I'm quite intrigued about these different behaviors between GHCs 7.6.3 and
> 7.8.3:
>
>
> GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer-gmp ... linking ... done.
> Loading package base ... linking ... done.
> Prelude> let x = 3 + 4
> Prelude> :print x
> x = (_t1::Integer)
> Prelude> :force x
> x = 7
> Prelude> print _t1
> 7
> Prelude>
>
>
> GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer-gmp ... linking ... done.
> Loading package base ... linking ... done.
> Prelude> let x = 3 + 4
> Prelude> :print x
> x = (_t1::Num a => a)
> Prelude> :force x
> x = _
> Prelude> print _t1
> ghc: panic! (the 'impossible' happened)
>   (GHC version 7.8.3 for x86_64-unknown-linux):
>     tcTyVarDetails a{tv atm} [tv]
>
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
>
>
> Is it really a bug or is it something I really shouldn't be doing? I've
> found this (fixed) bug (https://ghc.haskell.org/trac/ghc/ticket/8557),
> with a similar error output, but it does not seem to be the same case.
>
> Thanks
>
> Emilio
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>


-- 
Cheers,
Hamid.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20141001/609b5571/attachment-0001.html>

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

Message: 5
Date: Wed, 01 Oct 2014 12:37:36 +0200
From: Tilmann <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Connecting telnet connection to a wx
        widget
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed

Hi,

I am stuck at this problem. I want to read from a telnet connection and 
display the result in a wxHaskell widget (textCtrl). I got the widget 
and I got the connection piped to stdout, but I don?t know how to 
connect the two. Any help is greatly appreciated!
Versions: conduit 1.2.0.2, wx 0.91.0.0

Thanks a lot,
Tilmann


This is the code I got so far:


module Main where

import Control.Concurrent (forkIO, killThread)
import Control.Monad.IO.Class (MonadIO, liftIO)
import Control.Monad.Trans.Resource
import Data.Conduit
import Data.Conduit.Binary
import Network (connectTo, PortID (..))
import System.IO
import Graphics.UI.WX


main = start gui

gui = do
f <- frame []
t <- textCtrl f []
e <- entry f [on click := (onClick t "...")]
set f [layout := boxed "console" (grid 5 5 [[floatLeft $ expand $ 
hstretch $ widget t]
,[expand $ hstretch $ widget e]])]

onClick t val pt = set t [ text :~ \x -> val]

-- 
http://www.mega-nerd.com/erikd/Blog/CodeHacking/Haskell/telnet-conduit.html
telnet :: String -> Int -> IO ()
telnet host port = runResourceT $ do
(releaseSock, hsock) <- allocate (connectTo host $ PortNumber $ 
fromIntegral port) hClose
(releaseThread, _) <- allocate (forkIO $ runResourceT $ sourceHandle 
stdin $$ sinkHandle hsock) killThread
sourceHandle hsock $$ sinkHandle stdout



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

Subject: Digest Footer

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


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

End of Beginners Digest, Vol 76, Issue 1
****************************************

Reply via email to