Re: [Haskell-cafe] first the platform, the cabal

2009-09-20 Thread Martin Huschenbett
Hello Peter, cabal.exe is locatated in extralibs\bin. On my machine the installer added this directory to the PATH, too. Regards, Martin. Peter J. Veger schrieb: I just installed the Haskell Platform 2009.2.0.2 on Windows. There is no cabal.exe, only Cabal-1.6.0.3 How to continue: build

Re: [Haskell-cafe] Get data from HTML pages

2009-08-31 Thread Martin Huschenbett
Hello José, I've done a similar task some weeks ago and I used the Haskell XML Toolbox (hxt) [1] to do this. After learning how to program with arrows it was quite easy to write arrows that extract the relevant information from XML data. Regards, Martin. [1]

Re: [Haskell-cafe] List spine traversal

2009-07-01 Thread Martin Huschenbett
Hi Andrew, you will find it there but it's written in German. http://opus.kobv.de/tuberlin/volltexte/2008/1755/ Regards, Martin. Andrew Hunter schrieb: 2009/7/1 Matthias Görgens matthias.goerg...@googlemail.com: As a side note, (allowing seq and unsafePerformIO if necessary) is it possible

[Haskell-cafe] GHCI Curl under Windows

2009-06-03 Thread Martin Huschenbett
Hi Haskellers, I've installed the newest Haskell Platform under Vista and downloaded a pre compiled version of curl-7.19.4 for MinGW. After changing the build type in curl.cabal to Simple and supplying the needed paths I could even build and install curl for haskell. If I write a program

Re: [Haskell-cafe] Unfold fusion

2009-05-06 Thread Martin Huschenbett
Adrian Neumann schrieb: Hello, I'm trying to prove the unfold fusion law, as given in the chapter Origami Programming in The Fun of Programming. unfold is defined like this: unfold p f g b = if p b then [] else (f b):unfold p f g (g b) And the law states: unfold p f g . h = unfold p' f'

Re: [Haskell-cafe] Re: Grouping - Map / Reduce

2009-03-25 Thread Martin Huschenbett
Dear Günther, the map can't be consumed while it is constructed. At any point during its construction you don't know for any key in the map if it will appear in the not cosumed rest of the list again. This means you can't process any entry of the map because it may change later. The only

Re: [Haskell-cafe] Re: memory issues

2009-03-01 Thread Martin Huschenbett
ChrisK schrieb: Bulat is right about making Block's fields strict. -- | Get the offsets between entries in a list getSizes :: [Integer] - [Integer] getSizes (x:y:[]) = [y - x] getSizes (x:y:ys) = (y - x):(getSizes (y:ys)) You should change the first part to add maxSize: getSizes ::

Re: [Haskell-cafe] Supplying a default implementation for a typeclass based on another class

2009-03-01 Thread Martin Huschenbett
Hi, you could do something like instance (Show a,Read a) = Binary a where put = put . show get = fmap read get But then you will need the following language extensions: FlexibleInstances, OverlappingInstances, UndecidableInstances I don't know how safe this is but it seems to work.

[Haskell-cafe] Bug in HLint or haskell-src-exts?

2009-02-26 Thread Martin Huschenbett
Hello Haskellers, I've got the following piece of code type Memory addr value = Map.Map addr value type Stack item = [item] data MachineState addr value item = MachineState { memory :: Memory addr value , stack :: Stack item } deriving (Show) newtype Machine addr value item m a =

Re: [Haskell-cafe] Bug in HLint or haskell-src-exts?

2009-02-26 Thread Martin Huschenbett
Hello again, I found another problem I dont understand: evalOp :: Op - (Integer - Integer - Integer) evalOp op = case op of Plus - (+) Minus - \x y - max 0 (x-y) Times - (*) brings a parse error, too: Interpreter.hs:92:3: Parse failure, Parse error in expression: DVar [Ident

[Haskell-cafe] Bug in Cabal?

2009-02-17 Thread Martin Huschenbett
Hello haskell-cafe, trying to install ghci-haskeline I got the following error message: $ cabal install ghci-haskeline Resolving dependencies... cabal.exe: dependencies conflict: ghc-6.10.1 requires process ==1.0.1.1 however process-1.0.1.1 was excluded because ghc-6.10.1 requires process

Re: [Haskell-cafe] Deriving

2008-12-02 Thread Martin Huschenbett
If you use a newtype the answer to the second question is yes. Just put {-# LANGUAGE GeneralizedNewtypeDeriving #-} in the first line of your module or pass -XGeneralizedNewtypeDeriving to ghc or ghci. Daryoush Mehrtash schrieb: What happens when a type adds driving such as: newtype

Re: [Haskell-cafe] Extensible Exceptions

2008-11-23 Thread Martin Huschenbett
BTW, the documentation of catch is bad: the example catch (openFile f ReadMode) (\e - hPutStr stderr (Couldn't open ++f++: ++ show e)) does not type check. Is this a known bug or shall I report it anywhere? Regards, Martin. Ross Mellgren schrieb: I think catch is now basically

[Haskell-cafe] Problem installing curl

2008-11-11 Thread Martin Huschenbett
Hi all, when I try to install curl (needed for hxt) using cabal install curl I alwas get the following error message: Resolving dependencies... 'curl-1.3.2.1' is cached. Configuring curl-1.3.2.1... cabal: Error: some packages failed to install: curl-1.3.2.1 failed during the configure step.

Re: [Haskell-cafe] flipped IO sequence

2008-10-01 Thread Martin Huschenbett
Hi Cetin, what you seem to want is warn :: String - IO Int warn = (return 1 ) . putStrLn Cetin Sert schrieb: warn :: String → IO Int warn = return 1 putStrLn-- causes an error -- = \msg → return 1 putStrLn msg -- works just fine -- = \msg → putStrLn msg return 1 --

Re: [Haskell-cafe] Updated formlets sample?

2008-09-22 Thread Martin Huschenbett
, Martin Huschenbett wrote: Hi Chris, thanks for the updated example. Compiling works now. But when I try to run it I alway get error messages like [input0 is not in the data,input1 is not in the data] Regards, Martin. Chris Eidhof schrieb: Hey Martin, On 19 sep 2008, at 04:14, Martin

Re: [Haskell-cafe] Updated formlets sample?

2008-09-21 Thread Martin Huschenbett
Hi Chris, thanks for the updated example. Compiling works now. But when I try to run it I alway get error messages like [input0 is not in the data,input1 is not in the data] Regards, Martin. Chris Eidhof schrieb: Hey Martin, On 19 sep 2008, at 04:14, Martin Huschenbett wrote: I found

[Haskell-cafe] Updated formlets sample?

2008-09-19 Thread Martin Huschenbett
Hi all, I found a blog post concerning formlets [1] in the web. Since looks very interesting I tried to compile the sample code with recent versions of HAppS and formlets from hackage. But this didn't work as the API of formlets has changed since this post. I tried to adopt the code to the

Re: [Haskell-cafe] Real World HAppS: Cabalized, Self-Demoing HAppS Tutorial (Version 3)

2008-09-17 Thread Martin Huschenbett
Hi, I got your tutorial working. But when running it from ghci an exception raises: *** Exception: _local/interactive_state\current-00: openBinaryFile: invalid argument (Invalid argument) But I found a way to fix this: replace runserver 5001 by withProgName happs-tutorial $

Re: [Haskell-cafe] Real World HAppS: Cabalized, Self-Demoing HAppS Tutorial (Version 3)

2008-09-16 Thread Martin Huschenbett
Hi all, taking a look at this tutorial under Windows Vista I ran into a problem: happs-tutorial depends on HAppS-state which again depends on the unix package which doesn't work under windows. So my question is: is there another way to compile HAppS-State and happs-tutorial on windows?

[Haskell-cafe] Re: HXT namespace problem

2007-04-25 Thread Martin Huschenbett
Tim Walkenhorst schrieb: runX $ constA (request TableListRequest) root [] [writeA] writeDocument [(a_indent,v_1)] - writeDocument [(a_indent,v_1), (a_check_namespaces, v_1)] - should do the trick. a_check_namespaces unfortunately didn't do the trick. But using

[Haskell-cafe] HXT namespace problem

2007-04-24 Thread Martin Huschenbett
Hi all, I'm currently trying to generate XML documents with HXT. Everything went well but I can't figure out how to generate the xmlns:... attributes for the namespaces. My code looks like: runX $ constA (request TableListRequest) root [] [writeA] writeDocument [(a_indent,v_1)] -

[Haskell-cafe] A monad using IO, Reader, Writer, State and Error

2007-04-13 Thread Martin Huschenbett
Hi all, for my current project I need a monad that is an instance of MonadIO, MonadReader, MonadWriter, MonadState, and MonadError. I see two ways for defining such a monad using the mtl. 1) type MyMonad = ErrorT E (RWST R W S IO) and 2) type MyMonad = RWST R W S (ErrorT E IO) I can't

[Haskell-cafe] Re: A monad using IO, Reader, Writer, State and Error

2007-04-13 Thread Martin Huschenbett
Chris Kuklewicz schrieb: Martin Huschenbett wrote: 1) type MyMonad = ErrorT E (RWST R W S IO) 2) type MyMonad = RWST R W S (ErrorT E IO) So (1) gives (Left e,s,w) or (Right a,s,w) and (2) gives (Left e) or (Right (a,s,w)) Due to this fact i decided to use (1). If the operation fails and I

[Haskell-cafe] Re: Rank-2-polymorphism problem

2007-03-24 Thread Martin Huschenbett
apfelmus schrieb: For me, the fourth trial works, at least on f :: (forall s . Num s = Maybe s) - Int f y = case y of Just x - x Nothing - 0 This works, because the compiler knows that x has to have type Int. But if you want to apply a function g :: (forall a. Num a

[Haskell-cafe] Re: Rank-2-polymorphism problem

2007-03-24 Thread Martin Huschenbett
Martin Huschenbett schrieb: My thoughts were that for any class C the types Maybe (forall a. C a = a) (I will call it T1 for short) and (forall a. C a = Maybe a) (I will call it T2 for short) are isomorphic. Defining the isomorphism from T1 to T2 is quite simple: iso1 :: Maybe (forall

[Haskell-cafe] Rank-2-polymorphism problem

2007-03-23 Thread Martin Huschenbett
Hi, I'm writing some database code using HSQL and had to stop on a problem with rank-2-polymorphism that I can't solve. The essence of my code is: module Value where import Data.Maybe class SqlBind a where fromSqlValue :: String - a data Field data Value emptyValue :: Field - Value

[Haskell-cafe] Re: Rank-2-polymorphism problem

2007-03-23 Thread Martin Huschenbett
Ian Lynagh schrieb: readValue' :: Field - Maybe (forall s. SqlBind s = s) - Value readValue' fld s = if isJust s then readValue fld (fromJust s) else emptyValue fld Thank you very much, that's exactly what I wanted. After reading in the GHC users guide about rank 2 polymorphism I thought

[Haskell-cafe] Re: Rank-2-polymorphism problem

2007-03-23 Thread Martin Huschenbett
Hi again, the solutions/proposals of Ian and Iavor seem to be exactly what I need at a first glance. But looking at them more in detail reveals some other problems. I also have got a function getFieldValueMB :: SqlBind s = Statement - String - Maybe s To get Ians approach working I would

[Haskell-cafe] Re: Foralls in records

2007-03-14 Thread Martin Huschenbett
Hi, instead of writing a function getTransaction that retrieves the connection you could write a function withConnection that doesn't return the connection itself but performs an operation on the connection: withConnection :: (forall c. Connection c = c - Transaction a) - Transaction

[Haskell-cafe] Re: nested maybes

2007-02-04 Thread Martin Huschenbett
Hi, I've often got the same pattern with nested Maybes but inside the IO monad (sure this could be every other monad too). Assuming that I've got functions: getInput :: IO (Maybe Input) processInput :: Input - IO (Maybe Result) printError :: IO () printResult :: Result - IO () I observed me

[Haskell-cafe] Re: embedding haskell into html

2007-01-24 Thread Martin Huschenbett
Hi, I am new to haskell, and now working on embedding haskell into html. Thus we will write webapp using haskell as server-side language like php. Here I explain my plan and ask some questions, looking for experienced ones to discuss with. Maybe you should look at

[Haskell-cafe] Re: IO in lists

2007-01-17 Thread Martin Huschenbett
Hi, It's probably eaiser to work with normal lists: listChars :: IO [Char] listChars = do c - getChar if c == 'q' then return c else liftM2 (:) (return c) listChars But that is not lazy any more, is it? The idea of the OT was, I think, that he can use the first elements of the

[Haskell-cafe] Generating Source Code with Haskell

2007-01-01 Thread Martin Huschenbett
Hi, my aim is to transform an XML file into C++ source code with a Haskell program. The part that parses the XML is already finished (using HaXML) but the part that generates the C++ code is still remaining. Is there already any work on this topic? Maybe even on generating Java or any other

IORefs, MVars und CVars

2003-01-20 Thread Martin Huschenbett
I just started some multithreaded programming and as I am a newbie, I've gat a question. 1.) What are the differences between IORefs and MVars? 2.) What are CVars for? Thanks, Martin. ___ Haskell-Cafe mailing list [EMAIL PROTECTED]

Re: ffi

2002-12-12 Thread Martin Huschenbett
$ ghc -ffi -o myprog Main.hs cfile.o When I try this I also get an error: martin:~/work/prograemmelchen ghc -ffi -o myprog Main.hs cfile.o ghc-5.02.2: unrecognised flag: -ffi Usage: For basic information, try the `--help' option. Do I use a wrong GHC version? THX, Martin.

Re: ffi

2002-12-12 Thread Martin Huschenbett
-fffi three fs This time I also get an error: martin:~/work/prograemmelchen ghc -fffi -o myprog Main.hs cfile.o ghc-5.02.2: unrecognised flag: -fffi Usage: For basic information, try the `--help' option. Main.hs looks like: module Main ( main ) where foreign import ccall cfun cfun :: IO

ffi

2002-12-11 Thread Martin Huschenbett
Hi all, I've got a simple question concerning FFI but as I am a newbie I don't know the answet. I've got a C-source-file, maybe something like: //cfile.c void cfun() { /* ... do something ... */ } //EOF and a Haskell-source-File, maybe something like:

HDirect

2002-11-14 Thread Martin Huschenbett
Hi all together! Is there any newer version of HDirect than 0.17? Maybe an CVS-repository? THX, Huschi! ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe