Re: [Haskell-cafe] Record initialise question (RESOLVED)

2009-06-06 Thread John Ky
On Fri, Jun 5, 2009 at 8:05 PM, Martijn van Steenbergen mart...@van.steenbergen.nl wrote: Hi John, John Ky wrote: full = do let myOrder = init -- [1] { item = Just init { itemId = Something } , operation = Just

[Haskell-cafe] Conversion from string to array

2009-06-06 Thread John Ky
Hi Haskell Cafe, I'm trying to send stuff over UDP. To do that, I've written a test program that sends strings across. That was fine, but I wanted to send binary data too. So I tried that only to find I am having difficulty putting together some binary data. For examples take the fromHex

Re: [Haskell-cafe] Conversion from string to array

2009-06-06 Thread Neil Davies
Look at Data.Binary (binary package) It will marshall and unmarshall data types for you. If you don't like its binary encoding you can dive in there and use the same principles Cheers Neil On 6 Jun 2009, at 07:13, John Ky wrote: Hi Haskell Cafe, I'm trying to send stuff over UDP. To do

[Haskell-cafe] Why are these record accesses ambiguous

2009-06-06 Thread John Ky
Hi Haskell Cafe, In the following code, I get an error saying Ambiguous occurrence `x'. Why can't Haskell work out which x to call based on the type of getA? Thanks -John #!/usr/bin/env runhaskell {-# LANGUAGE DisambiguateRecordFields #-} import A import B main = do let xx = getA

Re: [Haskell-cafe] Why are these record accesses ambiguous

2009-06-06 Thread Miguel Mitrofanov
Probably because you don't apply x to xx anywhere? On 6 Jun 2009, at 11:48, John Ky wrote: Hi Haskell Cafe, In the following code, I get an error saying Ambiguous occurrence `x'. Why can't Haskell work out which x to call based on the type of getA? Thanks -John #!/usr/bin/env

Re: [Haskell-cafe] Why are these record accesses ambiguous

2009-06-06 Thread Luke Palmer
On Sat, Jun 6, 2009 at 1:48 AM, John Ky newho...@gmail.com wrote: Hi Haskell Cafe, In the following code, I get an error saying Ambiguous occurrence `x'. Why can't Haskell work out which x to call based on the type of getA? Thanks -John #!/usr/bin/env runhaskell {-# LANGUAGE

Re: [Haskell-cafe] Pike's Newsqueak talk

2009-06-06 Thread Adam Sampson
Tim Newsham news...@lava.net writes: Has anyone implemented a primitive like this for Haskell? This is the CSP external choice operator; it's often called select or alt in CSP-inspired languages. Neil Brown's CHP library provides CSP programming facilities in Haskell, including a - choice

Re: [Haskell-cafe] Why are these record accesses ambiguous

2009-06-06 Thread John Ky
Hi Luke, You're right. My code had a typo. Unfortunately, I still get the same error whichever way I do it. For example: {-# LANGUAGE DisambiguateRecordFields #-} import A import B main = do let xx = getA print (x xx) and: #!/usr/bin/env runhaskell {-# LANGUAGE

Re: [Haskell-cafe] Why are these record accesses ambiguous

2009-06-06 Thread Joe Fredette
The error is because of the way records work in Haskell. Recall that a record is just sugar for the normal datatype syntax. Namely: data FooA a b c = FooA {getA :: a, getB:: b, getC :: c} can be accessed as either f (FooA a b c) = ... or f fooA = ... (getA fooA) ... etc That is,

[Haskell-cafe] Re: Why are these record accesses ambiguous

2009-06-06 Thread Benedikt Huber
Hi John, The record field disambiguation only works if you use the form C{ field-name = variable } where C is a datatype constructor. In your example you have to write let TypeA{ x = v } = getA print v You're right, after type inference it is clear (for us) that x should mean A.x, but

[Haskell-cafe] Re: Pike's Newsqueak talk

2009-06-06 Thread Chung-chieh Shan
Tim Newsham news...@lava.net wrote in article pine.bsi.4.64.0906051608180.14...@malasada.lava.net in gmane.comp.lang.haskell.cafe: Could it be the amb described at http://conal.net/blog/posts/functional-concurrency-with-unambiguous-choice/

[Haskell-cafe] Re: Haddock : parse error on input `{-# UNPACK'

2009-06-06 Thread Dominic Steinitz
Erik de Castro Lopo mle+hs at mega-nerd.com writes: src/Data/Binary/Strict/IncrementalGet.hs:106:11: parse error on input `{-# UNPACK' Is this a bug? Is there any way to work around it? This is a haddock error and I presume a bug in haddock. I don't know whether cabal installs

[Haskell-cafe] Can't install chp (confused by cabal yet again)

2009-06-06 Thread Colin Paul Adams
I tried a cabal install chp: It complained that base was hidden. So I unpacked the archive, and tried installing using runhaskell Setup configure/build/install. Now I get (from install): Setup: You need to re-run the 'configure' command. The version of Cabal being used has changed (was

Re: [Haskell-cafe] nubBy seems broken in recent GHCs

2009-06-06 Thread Bertram Felgenhauer
Cale Gibbard wrote: According to the Report: nubBy:: (a - a - Bool) - [a] - [a] nubBy eq [] = [] nubBy eq (x:xs) = x : nubBy eq (filter (\y - not (eq x y)) xs) Hence, we should have that nubBy () (1:2:[]) = 1 : nubBy () (filter (\y - not (1 y)) (2:[])) = 1

[Haskell-cafe] using phantom types to validate html

2009-06-06 Thread Mathijs Kwik
Hi all, Please have a look at http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2575#a2575 I wanted to use the typesystem to mandate businesslogic (in this case w3c validation rules). Thanks to some helpful people in #haskell I learned a bit about phantom types. Please let me know if I implemented

[Haskell-cafe] Haskell Weekly News: Issue 120 - June 6, 2009

2009-06-06 Thread Brent Yorgey
--- Haskell Weekly News http://sequence.complete.org/hwn/20090606 Issue 120 - June 06, 2009 --- Welcome to issue 120 of HWN, a newsletter covering

[Haskell-cafe] ANNOUNCE: numtype 1.0 -- Type-level (low cardinality) integers

2009-06-06 Thread Bjorn Buckwalter
Dear all, Since its inception my dimensional library has been built around a unary type-level representation of integers (NumTypes) defined in the Numeric.NumType module. This module has proven itself useful outside the context of dimensional and after dragging my feet for a long time I've

[Haskell-cafe] Question on rank-N polymorphism

2009-06-06 Thread Vladimir Reshetnikov
Hi, I have the following code: fs g = (g fst, g snd) examples = (fs fmap, fs liftA, fs liftM, fs id, fs ($(1,2)), fs ((,)id), fs (:[]), fs repeat)

[Haskell-cafe] Still having problems building a very simple Executable ....

2009-06-06 Thread Vasili I. Galchin
Hello, I picked an exceedingly case to build an Executable: Executable QNameTest Hs-source-dirs: Swish/ Main-Is:HaskellUtils/QNameTest.hs Other-Modules: HaskellUtils.QName Here are the results of a cabal build -v: Creating dist/build/QNameTest (and its parents)

[Haskell-cafe] Re: Still having problems building a very simple Executable ....

2009-06-06 Thread Vasili I. Galchin
in the following harder case, I see no mention of path Swish/HaskellUtils . seems not good: /usr/local/bin/ghc -o dist/build/GraphPartitionTest/GraphPartitionTest --make -hide-all-packages -i -idist/build/GraphPartitionTest/GraphPartitionTest-tmp -iSwish/ -idist/build/autogen

Re: [Haskell-cafe] Re: Haddock : parse error on input `{-# UNPACK'

2009-06-06 Thread Erik de Castro Lopo
Dominic Steinitz wrote: Erik de Castro Lopo mle+hs at mega-nerd.com writes: src/Data/Binary/Strict/IncrementalGet.hs:106:11: parse error on input `{-# UNPACK' Is this a bug? Is there any way to work around it? This is a haddock error and I presume a bug in haddock.

Re: [Haskell-cafe] Still having problems building a very simple Executable ....

2009-06-06 Thread David Menendez
On Sat, Jun 6, 2009 at 7:45 PM, Vasili I. Galchin vigalc...@gmail.com wrote: Hello, I picked an exceedingly case to build an Executable: Executable QNameTest    Hs-source-dirs: Swish/    Main-Is:    HaskellUtils/QNameTest.hs    Other-Modules:  HaskellUtils.QName Here are

Re: [Haskell-cafe] Still having problems building a very simple Executable ....

2009-06-06 Thread Bertram Felgenhauer
Hi Vasili, Vasili I. Galchin wrote: I picked an exceedingly case to build an Executable: Executable QNameTest Hs-source-dirs: Swish/ Main-Is:HaskellUtils/QNameTest.hs Other-Modules: HaskellUtils.QName I'm not sure what you did; the original Swish code doesn't

Re: [Haskell-cafe] Re: I love purity, but it's killing me.

2009-06-06 Thread Chung-chieh Shan
On 2009-05-27T03:58:58-0400, Paul L wrote: One possible solution is to further introduce a fixed point data constructor, a Rec or even LetRec to explicitly capture cycles. But then you still incur much overheads interpreting them, I don't understand this criticism -- what interpretive overhead

[Haskell-cafe] Announce: haskeem 0.7.0 uploaded to hackage

2009-06-06 Thread Uwe Hollerbach
Hi, all, a little while ago I uploaded haskeem 0.7.0 to hackage: this is my small scheme interpreter. I had been busy with other important stuff for a while, and hadn't worked on it for a while; but I've now updated it to build ok with ghc 6.10.3 + haskeline, plus I added a simple macro system;

Re: [Haskell-cafe] Still having problems building a very simple Executable ....

2009-06-06 Thread Vasili I. Galchin
Hi David, I commented out Hs-source-dirs Executable QNameTest -- Hs-source-dirs: Swish/ Main-Is:HaskellUtils/QNameTest.hs Other-Modules: HaskellUtils.QName Here is what I got: vigalc...@ubuntu:~/FTP/Haskell/Swish-0.2.1$ cabal build -v Warning: swish.cabal: A

[Haskell-cafe] Re: Still having problems building a very simple Executable ....

2009-06-06 Thread Vasili I. Galchin
Here is the beginning of QNameTest .. i.e. interface plus imports: module Swish.HaskellUtils.QNameTest where^M ^M import System.IO^M ( Handle, IOMode(WriteMode)^M , openFile, hClose, hPutStr, hPutStrLn^M )^M ^M import Data.Maybe^M ( fromJust )^M ^M import Test.HUnit^M (

[Haskell-cafe] Building network package on Windows

2009-06-06 Thread Iavor Diatchki
Hi, I have been trying to build the package network from hackage (version 2.2.1.3) on Windows Vista, and I could really use some help. Building on the command line, or under cygwin completely failed (command line due to cabal not being able to execute something---possibly configure---although it

Re: [Haskell-cafe] Generic polyvariadic printf in Haskell98

2009-06-06 Thread Max Cantor
To be fair, isn't the printf typing in ocaml a massively ugly hack to the type system? Isn't there an example in the template haskell tutorial that gives a typesafe, clean generic printf function? Max On Jun 5, 2009, at 4:29 PM, Erik de Castro Lopo wrote: o...@okmij.org wrote: Still,