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.  Placement in module hierarchy (Moritz Fischer)
   2.  Newbie unicode utf8 question (Manfred Lotz)
   3. Re:  Newbie unicode utf8 question (Brandon Allbery)
   4. Re:  Placement in module hierarchy (Henk-Jan van Tuyl)
   5. Re:  Newbie unicode utf8 question (Manfred Lotz)
   6.  problem installing checkers (Britt Anderson)
   7.  cabal install happstack (Gary Klindt)
   8. Re:  cabal install happstack (Daniel Fischer)
   9. Re:  cabal install happstack (Brent Yorgey)
  10. Re:  problem installing checkers (Brent Yorgey)


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

Message: 1
Date: Sun, 23 Oct 2011 12:35:10 +0200
From: Moritz Fischer <hask...@pure-entropy.org>
Subject: [Haskell-beginners] Placement in module hierarchy
To: Haskell Beginners <beginners@haskell.org>
Message-ID: <4ea3edde.3070...@pure-entropy.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi list,

I've been working on bindings for pcsclite. The library allows for 
communicating with smartcard readers and RFID.
(My final goal is to hook it up to talk to a Mifare DESFire RFID card.)

Where would you place something like this?

System.Smartcard?


Cheers & happy hacking

Moritz

Btw: If you want to have a look at what I did so far (just basic 
functionality), check out http://github.com/mfischer/haskell-smartcard.
I'm open for comments on possible improvements.



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

Message: 2
Date: Sun, 23 Oct 2011 14:52:18 +0200
From: Manfred Lotz <manfred.l...@arcor.de>
Subject: [Haskell-beginners] Newbie unicode utf8 question
To: beginners@haskell.org
Message-ID: <20111023145218.671b8...@arcor.com>
Content-Type: text/plain; charset=UTF-8

Hi there,
I want to read a unicode file and print it to screen. My terminal was
unintentionally set to POSIX locale and that was the reason that it
didn't work properly.

When I added two hSetEncoding statements it worked fine, even under
POSIX.


Test file uc.in contains a simple line
        M?bius Ch?teau

Here is the small test program I tried:

<-----------------------------snip---------------------------->
module Main where

import System.IO
import Text.Printf

    
main :: IO ()
main = do
  h <- openFile "uc.in" ReadMode 
  hSetEncoding h utf8
  hSetEncoding stdout utf8
  s <- hGetContents h
  print s
  putStrLn $ "File contains line: " ++ s
  printf "File contains line: %s\n" s
<-----------------------------snap---------------------------->


Both putStrLn, and printf work fine. 

When setting a different locale, e.g. en_GB.iso88591 then both putStrLn
and printf work fine even if I haven't set encoding to utf in the
source.

Then I discovered System.IO.UTF8. However, when I use this as below
then the output is garbled.

<-----------------------------snip---------------------------->
module Main where

import System.IO
import System.IO.UTF8 as U
import Text.Printf

    
main :: IO ()
main = do
  h <- openFile "uc.in" ReadMode 
  hSetEncoding stdout utf8
  s <- U.hGetContents h
  U.print s
  U.putStrLn $ "File contains line: " ++ s
  printf "File contains line: %s\n" s
<-----------------------------snap---------------------------->


Any idea why this won't work.



-- 
Manfred





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

Message: 3
Date: Sun, 23 Oct 2011 09:01:13 -0400
From: Brandon Allbery <allber...@gmail.com>
Subject: Re: [Haskell-beginners] Newbie unicode utf8 question
To: Manfred Lotz <manfred.l...@arcor.de>
Cc: beginners@haskell.org
Message-ID:
        <CAKFCL4X+yuZ3JWa9+9Nrf6t+TLPP4N2QQ=HTSLuTNG=ryk=j...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Sun, Oct 23, 2011 at 08:52, Manfred Lotz <manfred.l...@arcor.de> wrote:

> Then I discovered System.IO.UTF8. However, when I use this as below
> then the output is garbled.
>

System.IO.UTF8 is intended for earlier versions of ghc which didn't support
I/O encoding; if you use it with modern ghc you're likely to get things
encoded twice, which will indeed be garbled.

-- 
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/20111023/672a4743/attachment-0001.htm>

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

Message: 4
Date: Sun, 23 Oct 2011 15:37:26 +0200
From: "Henk-Jan van Tuyl" <hjgt...@chello.nl>
Subject: Re: [Haskell-beginners] Placement in module hierarchy
To: "Haskell Beginners" <beginners@haskell.org>, "Moritz Fischer"
        <hask...@pure-entropy.org>
Message-ID: <op.v3s34ofdpz0...@zen5.arnhem.chello.nl>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
        delsp=yes

On Sun, 23 Oct 2011 12:35:10 +0200, Moritz Fischer  
<hask...@pure-entropy.org> wrote:

> Hi list,
>
> I've been working on bindings for pcsclite. The library allows for  
> communicating with smartcard readers and RFID.
> (My final goal is to hook it up to talk to a Mifare DESFire RFID card.)
>
> Where would you place something like this?
>
> System.Smartcard?

I would place common functionality for all types of Mifare cards in  
System.SmartCard or System.IO.SmartCard
and DESFire specific functionality in System.SmartCard.DESFire or  
System.IO.SmartCard.DESFire

Regards,
Henk-Jan van Tuyl


-- 
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--



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

Message: 5
Date: Sun, 23 Oct 2011 15:54:39 +0200
From: Manfred Lotz <manfred.l...@arcor.de>
Subject: Re: [Haskell-beginners] Newbie unicode utf8 question
To: beginners@haskell.org
Message-ID: <20111023155439.53842...@arcor.com>
Content-Type: text/plain; charset=US-ASCII

On Sun, 23 Oct 2011 09:01:13 -0400
Brandon Allbery <allber...@gmail.com> wrote:

> On Sun, Oct 23, 2011 at 08:52, Manfred Lotz <manfred.l...@arcor.de>
> wrote:
> 
> > Then I discovered System.IO.UTF8. However, when I use this as below
> > then the output is garbled.
> >
> 
> System.IO.UTF8 is intended for earlier versions of ghc which didn't
> support I/O encoding; if you use it with modern ghc you're likely to
> get things encoded twice, which will indeed be garbled.
> 

Aah, ok. Then I may safely ignore System.IO.UTF8.


-- 
Thanks,
Manfred





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

Message: 6
Date: Sun, 23 Oct 2011 18:56:57 -0400
From: Britt Anderson <britt.uwater...@gmail.com>
Subject: [Haskell-beginners] problem installing checkers
To: beginners@haskell.org
Message-ID:
        <cal4wg0hw0+qreyb1kjaent5rcxnqqbllmf9h4omycavv9zp...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I wanted to try reactive, but cabal install fails on checkers (a
dependency). Here is a portion of the error message, there are other
overlapping instances that follow. Can someone advise me how to
proceed. Thank you.

[13 of 15] Compiling Test.QuickCheck.Classes (
src/Test/QuickCheck/Classes.hs, dist/build/Test/QuickCheck/Classes.o )

src/Test/QuickCheck/Classes.hs:137:38:
    Overlapping instances for Show (a -> b)
      arising from a use of `property'
    Matching instances:
      instance Show (a -> b) -- Defined in Text.Show.Functions
      instance Show base:System.Event.Manager.IOCallback
        -- Defined in base:System.Event.Manager
    (The choice depends on the instantiation of `a, b'
     To pick the first instance above, use -XIncoherentInstances
     when compiling the other instance declarations)
    In the expression: property binopP
    In the expression: ("binop", property binopP)
    In the expression:
      [("identity", property identityP), ("binop", property binopP)]



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

Message: 7
Date: Mon, 24 Oct 2011 01:37:19 +0200
From: Gary Klindt <gary.kli...@googlemail.com>
Subject: [Haskell-beginners] cabal install happstack
To: beginners@haskell.org
Message-ID: <4ea4a52f.4050...@googlemail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hey Haskellers,

I tried to install happstack. Unfortunately I get the following error:
 > cabal install happstack
-Resolving dependencies...
-cabal: cannot configure deepseq-1.1.0.0. It requires containers >=0.2 
&& <0.4
-For the dependency on containers >=0.2 && <0.4 there are these packages:
-containers-0.2.0.0, containers-0.2.0.1 and containers-0.3.0.0. However 
none of them are available.
-containers-0.2.0.0 was excluded because containers-0.4.1.0 was selected 
instead
-containers-0.2.0.1 was excluded because containers-0.4.1.0 was selected 
instead
-containers-0.3.0.0 was excluded because containers-0.4.1.0 was selected 
instead

I wanted to deselect containers:
 > ghc-pkg unregister containers-0.4.1.0
-ghc-pkg: unregistering containers-0.4.1.0 would break the following 
packages: Cabal-1.10.2.0 (use --force to override)

But I did not want to use the force option, because I like cabal, and 
don't want to break it.

What should I do?
 > ghc --version
-6.12.1

Greets
Gary



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

Message: 8
Date: Mon, 24 Oct 2011 02:11:22 +0200
From: Daniel Fischer <daniel.is.fisc...@googlemail.com>
Subject: Re: [Haskell-beginners] cabal install happstack
To: beginners@haskell.org
Message-ID: <201110240211.22265.daniel.is.fisc...@googlemail.com>
Content-Type: Text/Plain;  charset="iso-8859-1"

On Monday 24 October 2011, 01:37:19, Gary Klindt wrote:
> Hey Haskellers,
> 
> I tried to install happstack. Unfortunately I get the following error:
>  > cabal install happstack
> 
> -Resolving dependencies...
> -cabal: cannot configure deepseq-1.1.0.0. It requires containers >=0.2
> && <0.4
> -For the dependency on containers >=0.2 && <0.4 there are these
> packages: -containers-0.2.0.0, containers-0.2.0.1 and
> containers-0.3.0.0. However none of them are available.
> -containers-0.2.0.0 was excluded because containers-0.4.1.0 was selected
> instead
> -containers-0.2.0.1 was excluded because containers-0.4.1.0 was selected
> instead
> -containers-0.3.0.0 was excluded because containers-0.4.1.0 was selected
> instead

Since ghc-6.12.* cam with containers-0.3.0.0, this means you have installed 
a newer version of containers.
That is generally not a good idea.
containers is one of the boot packages, ghc depends on it and thus many of 
the packages you install will depend on the version that came with ghc.

Run

$ ghc-pkg check

to see whether you already have some broken packages.

> 
> I wanted to deselect containers:
>  > ghc-pkg unregister containers-0.4.1.0
> 
> -ghc-pkg: unregistering containers-0.4.1.0 would break the following
> packages: Cabal-1.10.2.0 (use --force to override)

Hm, a bit strange, Cabal's dependencies list only base and filepath on 
hackage, although it also depends on containers, array, directory...
Anyway, your upgraded Cabal was built against containers-0.4.1.0, so it 
will break without that.

> 
> But I did not want to use the force option, because I like cabal, and
> don't want to break it.

Is it Cabal the library or cabal the executable?
If the latter, once it's built, it doesn't need the Cabal version it was 
built with to be present.

> 
> What should I do?

You could try

a) installing happstack with a constraint on the containers version to use,
$ cabal install --constraint="containers < 0.4" happstack
If nothing but Cabal on your system depends on containers-0.4.1.0 yet, that 
would probably work, but that would leave your installation open to 
breakage due to conflicting containers dependencies.

b) installing happstack with a later deepseq,
$ cabal install --constraint="deepseq > 1.1.0.0"

c) unregister Cabal-1.10.2.0, then containers-0.4.1.0, then reinstall 
Cabal-1.10.2 (--dry-run first, to check whether that would want to 
reinstall a new containers) [but you could also decide to use the 
Cabal-1.8.* that came with your ghc].

> 
>  > ghc --version
> 
> -6.12.1
> 
> Greets
> Gary




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

Message: 9
Date: Sun, 23 Oct 2011 21:30:19 -0400
From: Brent Yorgey <byor...@seas.upenn.edu>
Subject: Re: [Haskell-beginners] cabal install happstack
To: beginners@haskell.org
Message-ID: <20111024013019.ga26...@seas.upenn.edu>
Content-Type: text/plain; charset=us-ascii

On Mon, Oct 24, 2011 at 01:37:19AM +0200, Gary Klindt wrote:
> 
> I wanted to deselect containers:
> > ghc-pkg unregister containers-0.4.1.0
> -ghc-pkg: unregistering containers-0.4.1.0 would break the following
> packages: Cabal-1.10.2.0 (use --force to override)

By the way, if you just want to hide a package so that it will not be
considered when building other packages, you should use 'ghc-pkg
hide', not 'ghc-pkg unregister'.

-Brent



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

Message: 10
Date: Sun, 23 Oct 2011 21:42:20 -0400
From: Brent Yorgey <byor...@seas.upenn.edu>
Subject: Re: [Haskell-beginners] problem installing checkers
To: beginners@haskell.org
Message-ID: <20111024014220.gb26...@seas.upenn.edu>
Content-Type: text/plain; charset=us-ascii

On Sun, Oct 23, 2011 at 06:56:57PM -0400, Britt Anderson wrote:
> I wanted to try reactive, but cabal install fails on checkers (a
> dependency). Here is a portion of the error message, there are other
> overlapping instances that follow. Can someone advise me how to
> proceed. Thank you.
> 
> [13 of 15] Compiling Test.QuickCheck.Classes (
> src/Test/QuickCheck/Classes.hs, dist/build/Test/QuickCheck/Classes.o )
> 
> src/Test/QuickCheck/Classes.hs:137:38:
>     Overlapping instances for Show (a -> b)
>       arising from a use of `property'
>     Matching instances:
>       instance Show (a -> b) -- Defined in Text.Show.Functions
>       instance Show base:System.Event.Manager.IOCallback
>         -- Defined in base:System.Event.Manager

This is very naughty of System.Event.Manager, to define IOCallback as
a *type synonym* for a certain function type, and then declare a Show
instance for it.  However, the instance shouldn't come into play
unless System.Event.Manager is imported, and I don't think it is. So
this error message seems rather odd to me.  What version of GHC do you
have?  What is the output of 'ghc-pkg list' and 'ghc-pkg check'?

-Brent



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

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


End of Beginners Digest, Vol 40, Issue 37
*****************************************

Reply via email to