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.  HXT and missing or null values (Ian Knopke)
   2.  cabal trouble(s!) (Gregory Guthrie)


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

Message: 1
Date: Wed, 13 Jun 2012 16:29:32 +0100
From: Ian Knopke <ian.kno...@gmail.com>
Subject: [Haskell-beginners] HXT and missing or null values
To: beginners-requ...@haskell.org, beginners@haskell.org
Message-ID:
        <CAC+f4wkJQMYp-N==pp8c3yhinj22yy-znzb1hc-ddamh4fj...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I have an xml file I'm trying to parse using HXT. This is the code
(for some reason the list seems to be rejecting the XML example):

data Thing = Thing {first :: String, second :: String}
  getThings = atTag "thing" >>>
  proc x -> do
      first     <- text <<< atTag "first" -< x
      second <- text <<< atTag "second" -< x

      returnA -< Thing {first = first,second = second}

atTag tag = deep (isElem >>> hasName tag)

text = getChildren >>> getText

parseThings str = runX (readString [withValidate no] str >>> getThings)

The problem is that sometimes one of the tags is empty.

I'd like the code to return something like Thing
{first="val",second=""} but instead the entire entry is skipped. Can
someone explain to me what I need to do to get a null or empty string
value inserted instead?

Ian



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

Message: 2
Date: Wed, 13 Jun 2012 12:23:05 -0500
From: Gregory Guthrie <guth...@mum.edu>
Subject: [Haskell-beginners] cabal trouble(s!)
To: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <08ef9da445c4b5439c4733e1f35705ba01a2767cb...@mail.cs.mum.edu>
Content-Type: text/plain; charset="us-ascii"

I have lots of problems with cabal - not sure why or how to correct them.
ghc-pkg check reports tons of issues, but all seem to be haddock-html, which 
doesn't sound too serious, or haddock-interfaces.
   Warning: haddock-html: 
C:\Users\guthrie\AppData\Roaming\cabal\doc\wxdirect-0.90.0.1\html doesn't exist 
or isn't a directory
   ...

Cabal install errors, For example;
   C:\Users\guthrie>cabal install gloss-examples
   Resolving dependencies...
   Configuring gloss-raster-1.7.4.4...
   Building gloss-raster-1.7.4.4...
   Preprocessing library gloss-raster-1.7.4.4...
   [1 of 2] Compiling Graphics.Gloss.Raster.Array ( 
Graphics\Gloss\Raster\Array.hs, dist\build\Graphics\Gloss\Raster\Array.o )
   Warning: Couldn't figure out LLVM version!
         Make sure you have installed LLVM
   ghc.exe: could not execute: opt

What is LLVM, and do/how I need to install it?

and another (of many) - perhaps unrelated:
C:\Users\guthrie\AppData\Roaming\cabal\bin>cabal install wxc
   Resolving dependencies...
   <command line>: cannot satisfy -package Cabal-1.10.2.0:
    Cabal-1.10.2.0-db589dd5d526d3111ac2fde0f9ab986c is unusable due to missing 
or recursive dependencies:
      array-0.3.0.2-8e9cd0144e87fa9cc86cc9031631c4f3 base-4.3.1.0-f520cd232cc386
   346843c4a12b63f44b containers-0.4.0.0-18deac99a132f04751d862b77aab136e 
directory
   -1.1.0.0-3a2367d72569467a8af8a231656ff1b8 
filepath-1.2.0.0-f132e9f7703da4e20a47f
   f2b9acf1ea1 old-time-1.0.0.6-445ce39cbcebd38069c25c0f383b728d 
pretty-1.0.1.2-abc
   7c632374e50e1c1927987c2651f0f 
process-1.0.1.5-b3dded8e54a2e13d22af410bdcfafff4
       (use -v for more information)
   cabal: Error: some packages failed to install:
   wxc-0.90.0.3 failed during the configure step. The exception was:
   ExitFailure 1

Trying to resolve them:
   C:\Users\guthrie\AppData\Roaming\cabal\bin>cabal install base
   Resolving dependencies...
   cabal: internal error: impossible

I've had several others, not sure if they are package specific issues, or some 
larger issue with cabal and libraries.
So I tried to fix them from a suggestion in SO; delete the ~/ghc & ~/cabal 
files and restart cabal, by a "cabal install cabal-install".

It gives:
   C:\Users\guthrie>cabal install cabal-install
  Resolving dependencies...
  In order, the following would be installed:
   deepseq-1.3.0.0 (reinstall) changes: array-0.4.0.0 -> 0.3.0.3
   containers-0.4.2.1 (reinstall) changes: array-0.4.0.0 -> 0.3.0.3
   old-time-1.0.0.7 (new version)
   directory-1.1.0.2 (reinstall) changes: filepath-1.3.0.0 -> 1.2.0.1,
   old-time-1.1.0.0 -> 1.0.0.7
   ...
   cabal: The following packages are likely to be broken by the reinstalls:
   time-1.4
   wxdirect-0.90.0.1
   random-1.0.1.1
   haskell-platform-2012.2.0.0
   QuickCheck-2.4.2
   ...
   ghc-7.4.1
   ...
   Cabal-1.14.0
   process-1.1.0.1
   haskell98-1.1.0.1
   haskell-src-1.0.1.4
   haskell-platform-2011.2.0.1
   haskell-src-1.0.1.4
   haskell-platform-2011.3.0.0
   ghc-7.0.4
   Use --force-reinstalls if you want to install anyway.

Lots of things there that I don't want to break, but not sure how to proceed.
Even trying a -force-reinstall just gives more errors and failures...

Running ghc 7.4.1, and Haskell platform 2012.2.0.0, cabal reports: 
cabal-install version 0.14.0, using version 1.14.0 of the Cabal library.



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

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


End of Beginners Digest, Vol 48, Issue 18
*****************************************

Reply via email to