Re: [Haskell-cafe] Haskell Platform and Leksah on Windows

2013-08-09 Thread David Virebayre
Hi,

If you go the EclipseFP approach, you may have installations troubles
too. In my case, it was due to having a version of GHC and libraries
that EclipseFP doesn't like.

Once I got it to work,  I loved it.

David.


2013/8/8 Dorin Lazar dorin.la...@gmail.com:
 Hi,
 I understood what's wrong about my approach - and since I want to use
 an IDE to assist me, I will try both EclipseFP and Sublime Text, to
 see how that works. My feeling was that since the leksah website
 suggested that cabal is the way to do it and since when I search for a
 Haskell IDE that is it, then it was obvious that the recommended way
 doesn't work as it should. In my mind the platform was broken, I
 understand now that it's not the platform, just this special way of
 using it.

 I was also in awe of the fact that nobody really says anything about
 these difficulties, and felt like an estranged child that messed
 things up badly; however, it seems that the real issue is that nobody
 really does it that way, and I was wrong to actually try it like that.
 As I said (or haven't, but will) once I will get the hang of it I will
 recount my experience for others to follow, hopefully in better terms
 than this frustrating first experience.

 Many thanks for everyone's advice on the list,
   Dorin

 On Thu, Aug 8, 2013 at 9:48 PM, Carter Schonwald
 carter.schonw...@gmail.com wrote:
 Hey Dorin,
 I don't understand your claims.

 1) haskell has worked perfectly well on windows for quite some time. I used
 HUGs nearly a decade ago, and in more recent time (2-3 years ago) I helped
 teach an introductory first computer science class using GHC where many
 students were doing great work using notepad++ and ghci.

  I don't understand your focus on emacs and make files.

 2)  if you want an IDE experience, Sublime Text with the right plugins, or
 perhaps EclipseFP are worth checking out.

 3) likewise, if you're finding tooling on windows unsatisfactory, help fix
 it! Bug reports, patches, or new tools and libraries are always welcome.
 Haskell is a relatively small community, and thusly limited manpower (we're
 all volunteers), so way to fix any problem is help out!

 cheers


 On Thu, Aug 8, 2013 at 3:30 AM, Dorin Lazar dorin.la...@gmail.com wrote:

  Hello,
  I am the original author of the post, and I finally received the
 emails from the mailman (probably there was an issue with the
 automated requests).
   My answers are inlined.

  1) Leksah should not be considered an official haskell ide, but merely
  one of
  many community supported editing tools. And frankly one of the less
  widely
  used ones at that! Leksah is not used much at all by anyone, though
  theres
  probably a handful of folks who do use it.
   Many folks use editors like Sublime Tex (2/3), Emacs, Vi(m), textmate,
  and
  many more.  Its worth noting that the sublime-haskell plugin for sublime
  text, and analogous packages for many other editors, provide haskell
  IDE-like powers, or at least a nice subset thereof.
   Unfortunately, I think the problem with this is that we have a
 different vision on how development should be done. I have extensive
 experience of working from console, with a simple text editor and
 hand-made Makefiles or anything similar. However, an IDE should be a
 productivity tool, that can help you improve your understanding of the
 language, and can assist you in following the proper syntax for a new
 language. While learning by doing 'write, save, compile, examine error
 message' is ok with me, it is slow, and it limits the time I can
 dedicate to learning the language itself. A better cycle is the
 current 'write, examine error message' of most IDEs, since it's faster
 and requires no context switch. Sure, editors can help there. IDEs do
 this by default.
   So it's normal of me to search for an IDE to better learn the
 language, I'll leave the emacs + console version for when I am
 productive in the language.

  2) There are people working on building better easily portable native
  gui
  toolkits, but in many respects, a nice haskelly gui toolkit is still
  something people are experimetning with how to do well. theres lots of
  great
  tools out as of the past year or two, many more in progress on various
  time
  scales, and gtk2hs is great for linux (and thats fine).
   Unfortunately, this is not what's advertised. In fact, on the leksah
 site, the recommended method is to have the IDE installed via cabal.
 In another mail Mihai calls me unreasonable, but I think it's
 reasonable to think that the recommended method should be the one that
 works.
   But the easy to tell truth is that the Haskell Platform for Windows
 is not mature enough yet. That is something I can understand, and I
 can recommend other beginners to install a Linux VM for Haskell. That
 is perfectly fine, zero cost, 100% gain. However, the mistakes from
 the Haskell Platform as it is now on Windows should be pointed out,
 and although I've been called a mystical animal that 

Re: [Haskell-cafe] Hackage Update Brigade

2013-05-29 Thread David Virebayre
2013/5/28 Conrad Parker con...@metadecks.org:

 For that proposal, there is also an informal github group for updating
 unmaintained packages,
 which anyone willing is welcome to join:

Say I would be willing to spend a few hours a month to fix some
problems, but I'm not very experienced;
I only use haskell for a few small programs at work, I'm not used to
working collaboratively (but willing to learn)
Would I still be able to be useful ?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Looking for portable Haskell or Haskell like language

2013-04-29 Thread David Virebayre
I've got ghc working here on a centos 5.5 machine. But without root
privilege, I don't know how.

Perhaps you can use a virtual machine with centos 5.5 (you'd have root
access on this machine), install ghc on this machine, compile your programs
there, then transfer that on the first computer ?


2013/4/27 Christopher Howard christopher.how...@frigidcode.com

 Hi. I've got this work situation where I've got to do all my work on
 /ancient/ RHEL5 systems, with funky software configurations, and no root
 privileges. I wanted to install GHC in my local account, but the gnu
 libc version is so old (2.5!) that I can't even get the binary packages
 to install.

 I've had success installing some other simple functional languages (like
 CLISP) on these same systems, so I was wondering if there was perhaps
 another language very similar to Haskell (but presumably simpler) with a
 super portable compiler easily built from source, which I could try.

 I'll admit -- I haven't tried the HUGS compiler for Haskell. The quick
 description didn't make it sound much more portable than GHC, but I
 guess I could try it if I heard some good reasons to think it would be
 more portable.

 --
 frigidcode.com


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Prolog-style patterns

2013-04-08 Thread David Virebayre
Hi Jan,

On one hand, I've never really needed this.
On the other hand, it looks like a nice syntaxic sugar addition, so if you
implemented this I would probably give it a try.

David.


2013/4/8 Jan Stolarek jan.stola...@p.lodz.pl

  You can achieve something similar with the ViewPatterns language
  extension.
 
  member _ [] = False
  member x (((x ==) - True) : _) = True
  member x (_ : xs) = member x xs
 Hi Tillmann,

 there are a couple of ways to achieve this in Haskell, for example using
 guards:

 member :: Eq a = a - [a] - Bool
 member _ [] = False
 member y (x:_) | x == y = True
 member y (_:xs) = member y xs

 The goal of my proposal is to provide a concise syntax, whereas
 ViewPatterns are very verbose and
 guards are slightly verbose. I want something simple and something that is
 very intuitive if
 you've programmed in Prolog :)

 Janek

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] introducing Maybe at managing level

2013-03-29 Thread David Virebayre
The link to LYAH that John provided,
http://learnyouahaskell.com/making-our-own-types-and-typeclasses ,
doesn't mention monad at all.

Laziness is mentionned only once while explaining recursive types, but
you could omit that line.

Now Algebraic is mentionned 6 times, but if you're afraid it might
scare someone, why not replace it by 'Haskell' ( thus, Algebraic data
type becomes Haskell data type, for the purpose of your introduction )


2013/3/29 Luc TAESCH luc.tae...@gmail.com:
 Thanks John.

 I was indeed thinking to Maybe and the monad bindings,
 and  LYAH, or http://book.realworldhaskell.org/read/error-handling.html

 the problems is I cannot uses these links in isolation ( to a Non
 haskellers) because they mention Monads, Lazyness, Algebric types, all this
 vocabularies that side track a beginner, ( or a manager ;-)

 then all I want to show is the generic concept ( powerpoint level)
 of how a forest of (non core) case can be streamlined in one major case (
 the good outcome) , and all the rest ( exceptions in a non technical sense)
 are catched by the maybe monad, without sidetracking the readability of the
 code .

 I saw this somewhere on the blogosphere, but cannot remember where..

 this is management level, and this is even worse than beginners techies,
 because they derails very quickly when talking details


 --
 Luc
 be.linkedin.com/in/luctaesch/
 Envoyé avec Sparrow

 Le vendredi 29 mars 2013 à 06:47, John Lato a écrit :

 In FP, I think this sort of problem is generally handled via algebraic data
 types rather than exceptions.  In particular this directly addresses the
 issue of exceptions don't necessarily shout themselves out, since the
 compiler warns you if you've missed a case.

 They sound mathy, but algebraic data types are actually a pretty simple
 concept.  I think the Learn You a Haskell explanation is decent:
 http://learnyouahaskell.com/making-our-own-types-and-typeclasses

 Provided I understand the context properly, actually using exceptions for
 this sort of issue would be extremely rare practice.


 On Fri, Mar 29, 2013 at 12:21 AM, luc taesch luc.tae...@gmail.com wrote:

 I was looking for some link introducing the way FP/ Haskell handles errors
 and Exceptions.

 This is for a non FP Guy, and ideally withought scaring them with Monads and
 category theory :-).

 for the background :

 the guy said : As I mentioned in another thread in banking (in particular)
 it is the exception processing that often dominates the functionality of a
 system - as the core concept is generally very straightforward. Developing
 for exception handling (not in a Java/C++ sense) is a tricky thing - as
 the exception don't necessarily shout themselves out - and are often why we
 have large misunderstood legacy systems which are hard to replace.



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Non polymorphic numerals option -- avoiding type classes

2012-12-27 Thread David Virebayre
Prelude :t [[1,2],3]

you have a list with 2 elements:
- [1,2]
- 3
the type of [1,2] is [Integer]
the type of 3 is Integer

But all elements in a list must have the same type.





2012/12/27 Rustom Mody rustompm...@gmail.com:


 On Thu, Dec 27, 2012 at 1:48 AM, Roman Cheplyaka r...@ro-che.info wrote:

 * Rustom Mody rustompm...@gmail.com [2012-12-26 20:12:17+0530]
  So is there any set of flags to make haskell literals less polymorphic?

 Yes, there is!

   % ghci -XRebindableSyntax
   GHCi, version 7.6.1: http://www.haskell.org/ghc/  :? for help
   Loading package ghc-prim ... linking ... done.
   Loading package integer-gmp ... linking ... done.
   Loading package base ... linking ... done.
import Prelude hiding (fromInteger)
   Prelude let fromInteger = id
   Prelude :t 3
   3 :: Integer

 Roman



 Thanks Roman -- that helps.
 And yet the ghci error is much more obscure than the gofer error:

 --- contents of .ghci ---
 :set -XRebindableSyntax
 let fromInteger = id
 -- ghci session -
 $ ghci
 GHCi, version 7.4.1: 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 :t 5
 5 :: Integer
 Prelude :t [[1,2],3]

 interactive:1:8:
 Couldn't match expected type `[Integer]' with actual type `Integer'
 Expected type: Integer - [Integer]
   Actual type: Integer - Integer
 In the expression: 3
 In the expression: [[1, 2], 3]


 - The same in gofer -
 Gofer session for:
 pustd.pre
 ? :t [[1,2],3]


 ERROR: Type error in list
 *** expression : [[1,2],3]

 *** term   : 3
 *** type   : Int
 *** does not match : [Int]
 --
 So the error is occurring at the point of the fromInteger (= id) but the
 message does not indicate that

 --
 http://www.the-magus.in
 http://blog.languager.org


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Survey: What are the more common Haskell IDEs in use ?

2012-11-24 Thread David Virebayre
I often use geany too

2012/11/24 Erik de Castro Lopo mle...@mega-nerd.com:
 Dan wrote:

 Because I see there are many preferences on what IDE to use for Haskell
 I've created a quick survey on this topic.

 Please click here and select your choices from the lists.

 http://kwiksurveys.com/s.asp?sid=oqr42h4jc8h0nbc53652


 Any comments/suggestions are welcome.

 I use Geany which is not on the list.

 Erik
 --
 --
 Erik de Castro Lopo
 http://www.mega-nerd.com/

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell showcase in 5 minutes

2012-02-28 Thread David Virebayre
Le 28 février 2012 14:45, Doug McIlroy d...@cs.dartmouth.edu a écrit :
 Here's an example that fits comfortably in 5 minutes--if
 your audience knows elementary calculus:
 http://www.cs.dartmouth.edu/~doug/powswer.html

404 invalid url !

David.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell-Cafe Tag (was: Optimizations and parallel execution in the IO for a small spellchecker)

2012-02-16 Thread David Virebayre
Le 15 février 2012 21:32, JP Moresmau jpmores...@gmail.com a écrit :
 OK, thanks all, I can stop worrying being an uncouth Frenchman, then...

Not that I post a lot, but you had me worried for a while, too.

David.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Poll: Do you want a mascot? -- please stop this

2011-11-24 Thread David Virebayre
2011/11/23 Giovanni Tirloni gtirl...@sysdroid.com:
 2. It floods people with email they don't care (unless they care to keep
 track of the results)

Not that I care that much about a mascot (I like the lamb though), but
a few threads about it hardly counts for a flooding.
Besides, a good email client would allows to group emails that belong
together (a thread) and mute them.

Also, this is café, right ? Aren't people subscribed to this list
supposed to expect a broad range of topics ?

David.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Data.Text.IO.hGetContents problem on windows

2011-09-20 Thread David Virebayre
Bonjour Café, bonjour Bryan

I have a program that works fine on linux, but doesn't on windows.

On windows XP with the latest Haskell platform, I get:
socket: 1860: hFileSize: invalid argument (Bad file descriptor)

I think the problem is with hGetContents from Data.Text.IO, but my
google-fu failed to help me find any information.

Is there something I'm doing wrong ?

David.

The source code of the part that fails is as follows:

-- Execute a command on a distant server using the rexec protocol.
rexec :: HostName -- server to connect to
  - Text -- user
  - Text -- password
  - TextEncoding -- server's text encoding
  - Text -- command to execute
  - IO (Maybe Text)
rexec !ip !ru !rp !enc cmd = handle rexec_error $ do
  hdl - connectTo ip (PortNumber 512)
  let end_param = T.singleton (chr 0)
 ctrl_string = T.concat [
 0, end_param,
 ru, end_param,
 rp, end_param,
 cmd, end_param
   ]
  hSetEncoding hdl enc
  TIO.hPutStr hdl ctrl_string
  -- make sure the control string is sent.
  hFlush hdl
  -- 1st char read is actually a error code which we ignore for now
  hGetChar hdl
  !res - TIO.hGetContents hdl
  hClose hdl
  return (Just res)

rexec_error :: SomeException - IO (Maybe Text)
rexec_error err = do
  putStrLn $ show err
  return Nothing

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Data.Text.IO.hGetContents problem on windows

2011-09-20 Thread David Virebayre
Re-bonjour Café, Bryan,

 I have a program that works fine on linux, but doesn't on windows.
 Is there something I'm doing wrong ?

Checking the source code for Data.Text.IO.hGetContents, I see that the
only time hFileSize is used is in chooseGoodBuffering when the
buffering is in block mode, so I have a workaround: I just set the
buffering in line mode, which forks for my case.

The documentation for hFileSize says
For a handle hdl which attached to a physical file, hFileSize hdl
returns the size of that file in 8-bit bytes.

So chooseGoodBuffering should check if the handle is a physical file
before trying to optimize the buffer size, right ?

However, I'm not sure how to check if the handle is a physical file.
hIsTerminalDevice wouldn't help here, I guess.
hIsSeekable give this on windows : socket: 1860: hIsSeekable:
invalid argument (Bad file descriptor)

Maybe the solution would be to try hFileSize, and set a default
buffering if an exception is caught ?

David.

 David.

 The source code of the part that fails is as follows:

 -- Execute a command on a distant server using the rexec protocol.
 rexec :: HostName     -- server to connect to
      - Text         -- user
      - Text         -- password
      - TextEncoding -- server's text encoding
      - Text         -- command to execute
      - IO (Maybe Text)
 rexec !ip !ru !rp !enc cmd = handle rexec_error $ do
  hdl - connectTo ip (PortNumber 512)
  let end_param = T.singleton (chr 0)
     ctrl_string = T.concat [
         0, end_param,
         ru, end_param,
         rp, end_param,
         cmd, end_param
       ]
  hSetEncoding hdl enc
  TIO.hPutStr hdl ctrl_string
  -- make sure the control string is sent.
  hFlush hdl
  -- 1st char read is actually a error code which we ignore for now
  hGetChar hdl
  !res - TIO.hGetContents hdl
  hClose hdl
  return (Just res)

 rexec_error :: SomeException - IO (Maybe Text)
 rexec_error err = do
  putStrLn $ show err
  return Nothing


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: EclipseFP 2.1.0 released

2011-09-03 Thread David Virebayre
Is it possible to install it with GHC7.2 ? I tried and it can't compile scion.

David.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-27 Thread David Virebayre
2011/8/27 aditya siram aditya.si...@gmail.com:
 Hi all,
 I would like for the GHCI interpreter to save its environment before
 reloading a file and allowed the user to revert back to that state if the
 compilation was unsuccessful.

That would be awesome. I would like this too.

David.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming

2011-07-08 Thread David Virebayre
2011/7/8 Heinrich Apfelmus apfel...@quantentunnel.de:

 Do you know any *small GUI programs* that you would *like* to see
 *implemented with Functional Reactive Programming?*

I may have an example.

 I would love to hear your examples, so that I can try to convert them to FRP
 style and test my library against them!

You want a description of the example, or the complete source code to
make it work ?

Cheers,

David.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming

2011-07-08 Thread David Virebayre
2011/7/8 Heinrich Apfelmus apfel...@quantentunnel.de:

 I want to hear!
 Just a description. :) You can also mention why you find it interesting etc.

Well I have an old program sitting around. Anyway, it's very simple :

The GUI has
- a window with a menu bar, 2 directory selects (source and dest
directories), 1 file select ( the 'patch file'), 1 textview to write
logging information, and a 'Convert' button to start.
- an about window that opens from a 'About...' menuitem
- A status bar.

The convert button stats an action that scans all applicable files in
a source directory, converts them and writes them in a destination
directory.

The conversion itself is irrelevant to the topic, in my case it
consists in searching for patterns in the file and replacing them,
according to a list of changes read from a file, the 'patch file'.

The progression is logged in the textview: file processed, strings
replaced. In the status bar, a percentage bar grows.



Why do I find it interesting ?

Most of the time I would do a program like the above with a command
line interface only. GUI programming can be tedious. Would FRP offer a
way to code such a simple, boring example in a fun way ?

Also, FRP is often concerned with animations, but I'd really like to
see if it works well for small utilities.

I have an old source code I can share, using gtk2hs, imperative style
(and also beginner-ugly style :) ). It's about 200 lines of codes and
a glade file. It just compiled and ran fine here.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [ANN] mysql-simple - your go-to package for talking to MySQL

2011-06-21 Thread David Virebayre
2011/5/2 Bryan O'Sullivan b...@serpentine.com:
 Hi, folks -
 Over the past few days, I've released two MySQL-related packages on Hackage
 that I think should be pretty useful.
 The first is mysql-simple: http://hackage.haskell.org/package/mysql-simple
 This is a mid-level binding to the MySQL client API. I aimed it squarely at
 being both fast and easy to use, and I'm very pleased with the results so
 far.

Hello,

Some feedback about a very first try with your library;

First of all, thanks a lot for releasing it, I hope it'll make many
people's life easier.
Also, thanks for taking the time to write a nice, thorough documentation.

The library was easy to install, thanks to cabal -- no troubles here.

I had trouble accessing the documentation : the last versions on
hackage have a build failure, so the doc isn't available. I was able
to see the documentation for mysql-simple-0.2.2.0 though.

The very first example didn't work for me :

{-# LANGUAGE OverloadedStrings #-}

 import Database.MySQL.Simple

 hello = do
   conn - connect defaultConnectInfo
   query conn select 2 + 2

   Couldn't match expected type `IO b'
   against inferred type `q - IO [r]'
In the expression: query conn select 2 + 2
In the expression:
do { conn - connect defaultConnectInfo;
 query conn select 2 + 2 }
In the definition of `hello':
hello = do { conn - connect defaultConnectInfo;
 query conn select 2 + 2 }

Using query_ instead of query brings a new error:

   Ambiguous type variable `r' in the constraint:
  `Database.MySQL.Simple.QueryResults.QueryResults r'
arising from a use of `query_' at ftmsql.hs:7:3-28
Possible cause: the monomorphism restriction applied to the following:
  hello :: IO [r] (bound at ftmsql.hs:5:1)
Probable fix: give these definition(s) an explicit type signature
  or use -XNoMonomorphismRestriction

Easily corrected, adding the pragma.
Next step was to try it, which took me a few steps:

*Main hello

interactive:1:0:
Ambiguous type variable `r' in the constraint:
  `Database.MySQL.Simple.QueryResults.QueryResults r'
arising from a use of `hello' at interactive:1:0-4
Probable fix: add a type signature that fixes these type variable(s)

*Main hello :: IO [Only Int]
*** Exception: Incompatible {errSQLType = LongLong, errHaskellType =
Int, errMessage = types incompatible}

*Main hello :: IO [Only Int64]

interactive:1:18: Not in scope: type constructor or class `Int64'

etc.

I would like to suggest modifying the exemple in the documentation to
look like this
--
{-# LANGUAGE OverloadedStrings #-}

import Database.MySQL.Simple
import Data.Int

myConnectInfo = defaultConnectInfo { connectHost = x.x.x.x,
connectUser= xx, connectPassword=, connectDatabase=xxx }

hello :: IO [Only Int64]
hello = do
  conn - connect myConnectInfo
  query_ conn select 2 + 2
--
That way a beginner has a starting point that compiles and that he can
run as is.



Next I modified the simple example to call a stored procedure, it
returns a resultset of 12 columns.
Unfortunately, I realised that QueryResults instances are defined up
to 10 elements only.
However, the documentation shows how to define a QueryResults
instance, so I created a datatype and tried to define the instance,
and got stuck with an error:

Couldn't match expected type `PlateauSel'
   against inferred type `Int - a'
In the expression: convertError fs vs
In the definition of `convertResults':
convertResults fs vs = convertError fs vs
In the instance declaration for `QueryResults PlateauSel'

Indeed, the documentation shows that convertError takes 3 parameters,
and I gave, as per the example, only 2.
But I'm not sure what to write for the 3rd parameter, the
documentation doesn't help me here.

To try, I put 0, and the test compiled. However, I had a connection
error number 1312, saying my procedure can't return a result set in
the given context. (The query I used works from the mysql
command-line interface)

I'm not sure if that means Database.MySQL supports calling stored
procedures that return a result set or not. I suspect not. Perhaps it
would be useful to add it in the documentation.

Thanks,

David.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [ANN] mysql-simple - your go-to package for talking to MySQL

2011-06-21 Thread David Virebayre
 You can access the docs on a slightly earlier version:
 http://hackage.haskell.org/package/mysql-simple-0.2.2.0

That's what I did.

 The doc specifies it here:

 convertError :: [Field] - [Maybe ByteString] - Int - a
 Throw a ConversionFailed exception, indicating a mismatch between the number 
 of columns in the Field and row, and the number in the collection to be 
 converted to.

 So if you're making an instance for a type that takes ten items from
 the collection, then put 10. Could always make this clearer.

That wasn't clear to me, but English isn't my first language, so maybe
that's why.


 To try, I put 0, and the test compiled. However, I had a connection
 error number 1312, saying my procedure can't return a result set in
 the given context. (The query I used works from the mysql
 command-line interface)
 Ah, I wouldn't know about that, I haven't used the mysql version.

I tried again with that code:


data PlateauSel = PS
  { psPlat :: Int
  , psArm :: Maybe Int
  , psTaille :: Int
  , psType :: Int
  , psEtat :: Int
  , psLoc :: Int
  , psDest :: Int
  , psCol :: Int
  , psEtg :: Int
  , psNiv :: Int
  , psPos :: Int
  , psRes :: Int
  }

instance QueryResults PlateauSel where
  convertResults [fa,fb,fc,fd,fe,ff,fg,fh,fi,fj,fk,fl]
 [va,vb,vc,vd,ve,vf,vg,vh,vi,vj,vk,vl]
 = PS a b c d e f g h i j k l
where !a = convert fa va
  !b = convert fb vb
  !c = convert fc vc
  !d = convert fd vd
  !e = convert fe ve
  !f = convert ff vf
  !g = convert fg vg
  !h = convert fh vh
  !i = convert fi vi
  !j = convert fj vj
  !k = convert fk vk
  !l = convert fl vl
  convertResults fs vs = convertError fs vs 12
hello :: IO [PlateauSel]
hello = do
  conn - connect myConnectInfo
  query_ conn call Plateau_Select(1)


But there's no improvement :

*Main hello
*** Exception: ConnectionError {errFunction = query, errNumber =
1312, errMessage = PROCEDURE robot.Plateau_Select can't return a
result set in the given context}
*Main

The problem isn't with the stored procedure, it works if I call it
from the mysql client.

(@x.x.x.x) [robot] (;) call Plateau_Select(1);
+---+---++--+--+--+-+-+---++--+-+
| IdPlateau | IdArmoire | Taille | Type | Etat | Localisation |
Destination | Colonne | Etage | Niveau | Position | Reserve |
+---+---++--+--+--+-+-+---++--+-+
| 1 |  NULL |  1 |2 |1 |1 |
   1 |   0 | 0 |  0 |0 |   1 |
+---+---++--+--+--+-+-+---++--+-+
1 row in set (0.03 sec)

Another information: it doesn't work either with HDBC-mysql, but it
does work with HDBC-odbc.





Another unrelated thing : the documentation states that the Query type
is designed to make it difficult to create queries by concatenating
strings.
I found out there are situations where you don't have a choice.

For example, how to write a function that returns the columns of a
table using show columns ?

type Champ = (String,String,String,String,String,String)
getColumns :: Connection - String - IO [Champ]
getColumns conn table = do
  query_ conn (fromString $ show columns from  ++ table)

if you try query conn show columns from  ( Only table), the query built is
show columns from 'x'
which fails.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How unique is Unique

2011-05-27 Thread David Virebayre
2011/5/27 Emil Axelsson e...@chalmers.se:

 Does anyone have any comments on the proposed solution? Are there any
 alternatives available?

It might be unsuitable where an administrator can change the system's
time while the program is running.

David.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Parallel compilation and execution?

2011-05-26 Thread David Virebayre
2011/5/26 michael rice nowg...@yahoo.com

 Thank, Daniel

 Multiple threads are in evidence in my system monitor, but I wonder why I'm
 getting two different answers, one twice the other. The first is the
 parallel solution and the second is the non.


Why do you add n1+n2+1 in the parallel program, but only n1+n2 in the
non-parallel one ?



 Michael

 ===

 {-
 import Control.Parallel

 nfib :: Int - Int
 nfib n | n = 1 = 1
| otherwise = par n1 (pseq n2 (n1 + n2 + 1))
  where n1 = nfib (n-1)
n2 = nfib (n-2)
 -}

 nfib :: Int - Int
 nfib n | n = 1 = 1
| otherwise = nfib (n-1) + nfib (n-2)

 main = do putStrLn $ show $ nfib 39

 =

 [michael@hostname ~]$ ghc --make -threaded nfib.hs
 [1 of 1] Compiling Main ( nfib.hs, nfib.o )
 Linking nfib ...
 [michael@hostname ~]$ ./nfib +RTS -N3
 204668309
 [michael@hostname ~]$ ghc --make nfib.hs
 [1 of 1] Compiling Main ( nfib.hs, nfib.o )
 Linking nfib ...
 [michael@hostname ~]$ ./nfib
 102334155
 [michael@hostname ~]$


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-06 Thread David Virebayre
2011/5/6 David Mazieres dm-list-haskell-c...@scs.stanford.edu:
   * Every aspect of the library is thoroughly document in haddock
     including numerous examples of use.

I'm reading the documentation, it's impressively well detailed. It has
explanations, examples, all that one could dream for.

Thanks !

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-06 Thread David Virebayre
2011/5/6 Ertugrul Soeylemez e...@ertes.de:
 David Mazieres dm-list-haskell-c...@scs.stanford.edu wrote:

 Please enjoy.  I'd love to hear feedback.

 Thanks a lot, David.  This looks like really good work.  I'm using the
 'enumerator' package, and looking at the types your library seems to use
 a similar, but more complicated representation.  Is there any particular
 reason, why you didn't base your library on an existing iteratee package
 like 'enumerator'?

David has documented some design decisions in
http://hackage.haskell.org/packages/archive/iterIO/0.1/doc/html/Data-IterIO.html#g:3

Perhaps you may find some answers there.

David (another one :) )

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Programming Chalenges: The 3n+1 problem

2011-04-15 Thread David Virebayre
2011/4/14 Sebastian Fischer fisc...@nii.ac.jp


 The advantage of this complicated definition is that you get a
 memoized version of the `fibonacci` function simply by using `fixmemo`
 instead of `fix`:


Wow. I think something about 'fix' just made sense thanks to your post,
though I had read a few blog posts about it.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell mail server fail?

2011-03-09 Thread David Virebayre
2011/3/10 wren ng thornton w...@freegeek.org

 Like Kenneth Hoste, I haven't been receiving mails from haskell-cafe@ nor
 libraries@ for a few days to a week now. What is the status of the mailing
 lists?


I don't have the status, but I am still receiving emails from cafe and
libraries.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread David Virebayre
I use kate too.

I tried and liked leksah, but the fact that everything is a project
with a cabal file felt to heavy for me when I just want to hack on a
single .hs file.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread David Virebayre
2011/3/3 JP Moresmau jpmores...@gmail.com:

 Hello, I'm one of the maintainers of EclipseFP. It is a real
 alternative: it works, it is maintained, supported and enhanced. I use
 it for my own projects, and of course I use it to work on the version
 of the scion library that ships with it, so we eat our own dogfood
 :-). A new minor version is going to come out in the next couple of
 weeks. Why don't you give it a try? We appreciate any feedback!

from  http://eclipsefp.sourceforge.net/eclipsefp2.html I understand that
building scion is automatically done, but can be optionally done it it's too
long.
but from http://eclipsefp.sourceforge.net/build.html I see that I do have to
build it. But :

git clone http://github.com/JPMoresmau/scion.git
Initialized empty Git repository in /data/code/scion/.git/
remote: Counting objects: 3563, done.
remote: Compressing objects: 100% (1310/1310), done.
remote: Total 3563 (delta 2137), reused 3342 (delta 1970)
Receiving objects: 100% (3563/3563), 580.09 KiB | 395 KiB/s, done.

Resolving deltas: 100% (2137/2137), done.

david@pcdavid:~/code$ cd scion/

david@pcdavid:~/code/scion$ sudo cabal install
[sudo] password for david:
Resolving dependencies...
cabal: dependencies conflict: ghc-6.12.3 requires Cabal ==1.8.0.6 however
Cabal-1.8.0.6 was excluded because scion-0.1.0.8 requires Cabal ==1.6.*

I'm not sure what to do now. Trying to install eclipsefp without scion built
in case it works, but I'm not used to eclipse, I could use some screenshots
to take me step by step through the process. For example, My project menu
has open grayed, and file/import wants me to choose an import source (I
chose Existing project into workspace) but then do I copy projects into
workspace ( I did not )

I have eclipse already setup with android development (I have just a toy
project, I planned to learn about android programming), when I imported the
projects they appeared at the same place. Is there a way not to mix android
and haskell projects ? Do I create a new workspace, or assign working sets ?

Anyway the projects are in the workspace, and there's 123 warnings; but I
can't really tell if the build failed or not.
Selecting all the project, and right-click - refresh didn't seem to change
anything.

But it seems it worked, because step 7 does launch a new eclipse window, and
I can see haskell in the preferences. Except that I had an error message
regarding scion, and stupid me, clicked ok before I could remember what was
written.

I tried rebuild scion, but nothing seemed to happen. I closed the first
Eclipse window (the one that has all the eclipsefp projects in the package
explorer), but then the second one closed too. I lauched eclipse again, run
configurations, etc and this time it looks like scion is building (well
something happens in the Console tab)

While this is building, I'm wondering if there's a way to launch eclise
directly in the right mode. Not having to go to run configurations, etc.

Ah, the build failed. Complains that HUnit is missing. So I cabal install
it, close my Eclipse window, run configurations again on the first Eclipse
window, and the build resumes.

 And build success. Now to open a haskell source file and play with
Eclipse.

/feedback

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread David Virebayre
2011/3/7 David Virebayre dav.vire+hask...@gmail.com

  And build success. Now to open a haskell source file and play with
 Eclipse.


... and I keep having those Problem occurred popups:

'Occurrences has encountered a problem
An internal error has occurred.

In the detail:

An internal error has occurred.
java.lang.NullPointerException

In show error log tab, 3 messages; all have 'net.sf.eclipsefp.haskell.ui' in
the Plug-in column :
TWICE:
eclipse.buildId=M20100211-1343
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=fr_FR
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data
/data/code/eclipse/../runtime-New_configuration -dev
file:/data/code/eclipse/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties
-os linux -ws gtk -arch x86


Info
Mon Mar 07 15:15:13 CET 2011
cabal executable: /usr/local/bin/cabal, cabal-install 0.8.2, Cabal library
version 1.8.0.2

AND ONCE:
eclipse.buildId=M20100211-1343
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=fr_FR
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data
/data/code/eclipse/../runtime-New_configuration -dev
file:/data/code/eclipse/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties
-os linux -ws gtk -arch x86


Info
Mon Mar 07 15:03:33 CET 2011
cabal executable: /home/david/bin/cabalinit, cabal-install , Cabal library
version

Cheers,

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Rendering of hask in new wiki (MSIE6)

2010-12-22 Thread David Virebayre
 Statistics from A tour of the Haskell Monad functions (on my site), after
 15.351 pageviews:

I find it surprising that nobody using google chrome ever browsed your site.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] the beginning of the end

2010-12-05 Thread David Virebayre
2010/12/5 Andrew Coppin andrewcop...@btinternet.com

 I get Haskell. It's a programming language. You write programs with it. I get 
 VB - even if I think it sucks. But something like Stack Overflow, I find 
 myself just staring at it thinking what the hell /is/ this thing?

It's quite simple.

Level 1

- You have an unresolved programming problem. You ask the question on
stack overflow. People give you answers.
- You can (if you wish) provide answers for questions others have asked.

Level 2

To weed out bad material, answers and questions are voted up or down
(supposedly) based on their pertinence, by the users.

Level 3

Each upvote earns a user some points, and the opposite for a downvote.
Users then have a score. Answers from a user with a high score might
be more reliable.

Level 4

There is a system of badges to earn, perhaps so that one finds some
extra amusement in helping others.

Level 5

I'm out of layers here. I think this is all there is to it.

David.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Question about TagSoup

2010-12-03 Thread David Virebayre
Hello café,

I have seen tutorials about extracting information from a tag soup, but I
have a different use case:
I want to read a xml file, find a tag, change its content, and write the xml
file back.

This is an example of the files

?xml version=1.0 encoding=UTF-8 standalone=yes?
idPkg:Story xmlns:idPkg=
http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging; DOMVersion=7.0
   Story Self=ub9fad AppliedTOCStyle=n TrackChanges=false
StoryTitle=$ID/ AppliedNamedGrid=n
   StoryPreference OpticalMarginAlignment=false
OpticalMarginSize=12 FrameType=TextFrameType
StoryOrientation=Horizontal StoryDirection=LeftToRightDirection/
   InCopyExportOption IncludeGraphicProxies=true
IncludeAllResources=false/
   ParagraphStyleRange
AppliedParagraphStyle=ParagraphStyle/prix
   CharacterStyleRange
AppliedCharacterStyle=CharacterStyle/$ID/[No character style]
   Contentzzznba5/Content
   /CharacterStyleRange
   /ParagraphStyleRange
   /Story
/idPkg:Story

Assuming I want to change the content of the Content tag, this is what I
came up with (simplified), I'm using direct recursion. Is there a better way
?

ts = do
 soup - parseTags `fmap` readFile idml/h00/Stories/Story_ub9fad.xml
 writeFile test $ renderTagsOptions renderOptions{optMinimize = const
True}
  $ modif soup

modif [] = []
modif (x@(TagOpen Content []):TagText _m : xs) = x : TagText modified :
modif xs
modif (x:xs) = x : modif xs

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC 7.0.1 developer challenges

2010-11-30 Thread David Virebayre
2010/11/30 Ryan Ingram ryani.s...@gmail.com

 On Mon, Nov 29, 2010 at 12:36 AM, Simon Peyton-Jones
 simo...@microsoft.com wrote:
  Do you have an alternative to suggest?  After all, the previous situation
 wasn't good either.

 I suggest that we should be able to specify RTS options at
 compile/link time, or as pragmas in the Main module.


That would be nice.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Catching up on Time and Directory

2010-11-16 Thread David Virebayre
2010/11/16 Jon Fairbairn jon.fairba...@cl.cam.ac.uk:

 I'm probably terribly out of date with this, so I wonder if
 anyone can save me the bother of working out what the
 /preferred/ libraries are for (a) determining the
 last-modified-time of a file or directory and (b) manipulating
 the resulting time datum.

 I can find System.Directory.getModificationTime and
 Data.Time.formatTime, but using them together seems unduly
 awkward.

I'm interested too. There's so many times and dates types it's confusing.
I had a problem last week, got it to compile but I'm not sure I'm
doint it right. ( asked but got no replies on the list )

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Is there a better way to convert from UTCTime to EpochTime ?

2010-11-10 Thread David Virebayre
I want to set a file's modification time to the time I got from exif data.

To get the time from exif, I found :
Graphics.Exif.getTag :: Exif - String - IO (Maybe String)

To set the file modification time, I found :
System.Posix.Files.setFileTimes :: FilePath - EpochTime - EpochTime - IO ()

Assuming I do find a Time in Exif, I need to convert a String to an EpochTime.

- With parseTime I can get a UTCTime.
- With utcTimeToPOSIXSeconds I can get a POSIXTime
- With a POSIXTime I can more or less get an EpochTime

To convert from a UTCTime to EpochTime this typechecks, but I'm not
sure it's correct :
fromIntegral . fromEnum . utcTimeToPOSIXSeconds $ etime

This is part of a function getTime that will return the time from Exif
data, if present, otherwise the file's modification time :

getTime (path,stat) = do
  let ftime = modificationTime $ stat
  err (SomeException _) = return ftime
  time - liftIO $ handle err $ do
exif - Exif.fromFile path
let getExifTime = MaybeT . liftIO . Exif.getTag exif
res - runMaybeT $ do
  tmp - msum . map getExifTime $ [ DateTimeOriginal,
DateTimeDigitized, DateTime ]
  MaybeT . return . parseTime defaultTimeLocale %Y:%m:%d %H:%M:%S $ tmp
case res of
  Nothing- return ftime
  Just etime - return . fromIntegral . fromEnum .
utcTimeToPOSIXSeconds $ etime
  return (path,time)

Questions :

1) is there a better way to convert the time ?
2) any general comments on getTime ?

Thanks,

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell is a scripting language inspired by Python.

2010-11-05 Thread David Virebayre
 Also they don't scale well, which I guess means that they don't
make it inconvenient to design badly. 
Luke Palmer

I nominate the above for quote of the week !
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] In what language...?

2010-10-26 Thread David Virebayre
2010/10/25 Gregory Collins g...@gregorycollins.net

 Andrew Coppin andrewcop...@btinternet.com writes:

  Hypothesis: The fact that the average Haskeller thinks that this kind of 
  dense
  cryptic material is pretty garden-variety notation possibly explains why
  normal people think Haskell is scary.

 That's ridiculous.

That's not so ridiculous in the sense that some people might (wrongly)
think they won't understand haskell until they understand at least
some of that cryptic material.
Many long discussion about Haskell on reddit seem to have a beginner
thinking he must understand monads before going on.
Yes, the  famous monads which aren't that complicated at all, still
they are part of this dense cryptic material when you're a newbie that
used to think he's smart because he knows c, pascal, basic, php , and
learned postscript's basics in a few days (Then you start looking at
this curiosity called haskell, and you stumple upon haskell-cafe, and
then you are humbled.) (I might be talking about the 3 years ago me,
here :) )

 You're comparing apples to oranges: using Haskell and understanding the
 underlying theory are two completely different
 things.

Agree 100%, but it's not automatic to see it that way for a newcomer.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskellers design

2010-10-21 Thread David Virebayre
2010/10/21 Michael Snoyman mich...@snoyman.com



 * How important is adhering to a standard look?


Important yet it should not feel like it's impossible to try new things


 * Which theme is overall more visually appealing?


2nd


 * Which theme gives a more professional feel?


2nd

 David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskellers.com skills list moderation?

2010-10-19 Thread David Virebayre
2010/10/18 Andrew Coppin andrewcop...@btinternet.com:

 ...I thought *I* was the only person who's ever heard of Rexx?

... and thanks to you, I now know some people here have heard of Amiga :)

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Who is afraid of arrows, was Re: [Haskell-cafe] ANNOUNCE: Haskell XML Toolbox Version 9.0.0

2010-10-14 Thread David Virebayre
2010/10/13 Henning Thielemann schlepp...@henning-thielemann.de:
 David Virebayre schrieb:
 2010/10/12 Gregory Crosswhite gcr...@phys.washington.edu:

 Also, I don't see why one would prefer  over the standard function
 composition operator, ..

 With .  you have to read right-to-left to follow data's path.

 For me that reading order isn't natural, and I imagine it is so for
 most people which don't have a mathematical background.

 http://www.haskell.org/haskellwiki/Direction_of_data_flow

Very informative link, thanks. Fortunately the time when I was
struggling with all that is gone; Even though right-to-left still
isn't natural to me, I've now written enough haskell so that isn't a
problem anymore. I don't even try to use  redefine a left-to-right
composition operator in my programs, I'm converted !

My previous post was just me remembering my (past) problems with .
to answer Gregory's question.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Who is afraid of arrows, was Re: [Haskell-cafe] ANNOUNCE: Haskell XML Toolbox Version 9.0.0

2010-10-13 Thread David Virebayre
2010/10/12 Gregory Crosswhite gcr...@phys.washington.edu:

 Also, I don't see why one would prefer  over the standard function
 composition operator, ..

With .  you have to read right-to-left to follow data's path.

For me that reading order isn't natural, and I imagine it is so for
most people which don't have a mathematical background.

Combined with = /  you have multiple reading direction in the same
expression, as in

expression  ( c . b . a ) `liftM` a1 = a2 = a3
reading order 6   5   41  2  3

So that could be one reason.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskellers.com recent changes (and I need some volunteers)

2010-10-10 Thread David Virebayre
2010/10/10 Michael Snoyman mich...@snoyman.com:

Hi,

 Haskellers became popular a lot faster than I'd anticipated. This has

I've noticed a new 'flag this user' on my profile, but it's not clear
(at least to me) what this does. Out of curiosity, I clicked on it,
got a uninformative (again, to me) message A flag message has been
sent to the admins. Thanks!

 easier to add the status. Also, don't take it personally if an admin
 denies your real haskeller request; it's currently a very poorly
 defined notion, and I don't even know who the admins are going to be.

I don't like this notion, or at least how it's called. What is
supposed to be a real haskeller ? For example, I do use haskell for
small things, try to advocate it around me as much as I can, but at
the same time I never contributed to a project, or released a package.
I don't think I'm worthy of a special status, so I wouldn't ask for
real haskeller status. At the same time, I don't feel like a fake
Haskeller either.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] benchmarking c/c++ and haskell

2010-09-13 Thread David Virebayre
Does it help to compile with ghc --make -O2 -funbox-strict-fields  ??

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Paralelism and Distribution in Haskell

2010-09-07 Thread David Virebayre
2010/9/7 Ben Lippmeier b...@ouroborus.net:
 Though be warned you must use a recent GHC head build to get good 
 performance. After GHC 7.0 is out (in a few weeks) we'll be able to release a 
 properly stable version.

Pardon a probably stupid question, but did I miss something ?

http://hackage.haskell.org/trac/ghc/roadmap

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Paralelism and Distribution in Haskell

2010-09-07 Thread David Virebayre
 This is not stupid, but yes you missed something :)
 http://www.reddit.com/r/haskell/comments/dad6j/unless_theres_a_major_hiccup_itll_be_in_ghc_70/

Oh, I saw that thread, but at the time it had vrey few comments, so I
definately missed something !

Thanks !

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Oracle stored procedures

2010-09-07 Thread David Virebayre
2010/9/7 Peter Marks pe...@indigomail.net:
 Are there any Haskell libraries that can call stored procedures in Oracle?
 I've been looking at Takusen which I like, but I can't find a way to call a
 stored procedure.

Don't you need to execute a SELECT query that calls the procedure, as in

select my_procedure(parameter)

Not sure though, I've never used stored procedures.

David
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: text 0.8.0.0, fast Unicode text support

2010-09-01 Thread David Virebayre
2010/9/1 Tako Schotanus t...@codejive.org:
 As a Haskell noob I'm curious about this statement, is there something
 intrinsically wrong with String?

String is just a linked list of Char which are unicode code points;
which is probably not the optimal way to store text.
For intensive use of text it takes too much memory, and/or it's not
fast enough.

Sometimes I'd love if I could program using String and the compiler
would automatically convert that to Text, or Bytestrings, but of
course it's wishful thinking.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage on Linux

2010-08-24 Thread David Virebayre
2010/8/24 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com:

 What do you mean by metapackages?

Metapackage are packages of packages, they don't provide something by
themselves, but they have a dependency list so that a set of package
can be installed together.

For example, on ubuntu, installing build-essentials will pull gcc,
make, autoconf, etc from the repositories.

Another example would be the haskell platform, on debian it's a
metapackage that depends on all the individual packages of libraries
and tools that belong to the platform.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Changing my Profile

2010-08-24 Thread David Virebayre
2010/8/23 Christopher Done chrisd...@googlemail.com:

 Any suggestions would be appreciated.

Isn't there the possibility to mute a thread in gmail ? You need to
activate keyboard shortcuts, then ? gives you a list of keys. m
seems to be used to mute a thread, but I didn't try it so I don't know
what it does exactly.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-09 Thread David Virebayre
On Fri, Aug 6, 2010 at 5:58 PM, Alex Stangl a...@stangl.us wrote:
 On Fri, Aug 06, 2010 at 10:17:26AM -0500, aditya siram wrote:
 From my vantage point they are (in no particular order) : Reader, Writer,
 State, IO, ST, STM, Parsec (have I missed any?) and of course the
 transformer versions. I am debating whether or not to add [] to the bunch.

 Not sure how much time you have budgeted, but I'd start with a simple
 one like Maybe, actually show how to implement it, then move on to list,

I second that. Especially, if the audience is more familiar with
imperative langages, then the reader, writer and state monad may not
immediately impress them.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Preview the new haddock look and take a short survey

2010-08-07 Thread David Virebayre
On Sat, Aug 7, 2010 at 7:54 AM, Magnus Therning mag...@therning.org wrote:

 jokeWouldn't the docs be unusable if it were in French even if
 Haddock handled unicode characters correctly?/joke

Joke aside, for software to be released, a French documentation indeed
wouldn't be of much use. The langage of technology and science and les
internets is English, and I'm fine with that.

I would only document software in French that is written for my
company, and isn't supposed to be released.

I hope we're not hijacking the thread here :)

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] what's the best environment for haskell work?

2010-08-06 Thread David Virebayre
On Fri, Aug 6, 2010 at 6:11 AM, Hamish Mackenzie
hamish.k.macken...@googlemail.com wrote:

 On 5 Aug 2010, at 21:12, David Virebayre wrote:

 Can you try out this...

 ~/haskell/test$ cat ~/bin/cabal_quick_init
 #!/bin/sh

 SOURCE_FILE=$1
 CABAL_NAME=`basename -s .lhs $SOURCE_FILE`
 CABAL_NAME=`basename -s .hs $CABAL_NAME`
 echo Creating Cabal Package $CABAL_NAME
 echo For file $SOURCE_FILE
 mkdir $CABAL_NAME.package || exit
 cd $CABAL_NAME.package || exit
 cabal init -n -p $CABAL_NAME --is-executable --source-dir=.. || exit
 sed -e s/-- *[mM]ain-[iI]s *\:/Main-is:$SOURCE_FILE/ -i  
 $CABAL_NAME.cabal || exit

This script doesn't word as-is for me. basename doesn't have a -s
option, but that's easily corrected.
Then, I couldn't get the sed command to work, so I edited manually the
cabal file to modify and uncomment the Main-is line.

 This will make a Euler/Euler.cabal file.  You can then simply add that .cabal 
 file to your workspace (right click in the Workspace pane).

Actually it makes a Euler.package/Euler.cabal file. Minor detail :)

 I'll try to fix leksah Euler.hs so it does the following
 * if the file belongs to an package in the workspace open the file and 
 activate the package
 * if not ask the user if they want to simply open it or cabalize it

That would be great.

 We do plan to fix this in the same way we resolve missing imports.  I had a 
 look to see if I could do it when a user cabalizes the source, but ghc 
 --make -v does not include the packages automatically loaded in its output.  
 Instead we will need to wait for the error then resolve it when the user 
 presses Ctrl+R.

Continuing on my Euler.hs example, I then created the cabal package
with your script. Added the package, then tried to build.

../Euler.hs:1:0:
Failed to load interface for `Prelude':
  It is a member of the hidden package `base'.
  Perhaps you need to add `base' to the build-depends in your .cabal file.
  It is a member of the hidden package `base-3.0.3.2'.
  Perhaps you need to add `base' to the build-depends in your .cabal file.
  Use -v to see a list of the files searched for.


I didn't find a way to automatically fill the dependencies, Ctrl-R
doesn't seem to do something.
I added base = 4 using the package editor, then it build.

By the way, did I mention you guys are doing an awesome job with leksah ?

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Preview the new haddock look and take a short survey

2010-08-06 Thread David Virebayre
I prefer the new look.

That being said, I'd rather like haddock handling unicode characters
in comments, at the moment it's unusable if I want to write comments
in French.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] what's the best environment for haskell work?

2010-08-05 Thread David Virebayre
On Wed, Aug 4, 2010 at 8:01 PM, Hamish Mackenzie
hamish.k.macken...@googlemail.com wrote:
 I use Leksah and have done since I started contributing to it.  The best way 
 to make it work for you is to use Leksah to fix what you don't like about 
 Leksah ;-)  Failing that giving good feedback about bugs and missing features 
 is the next best thing.

I did check the bug/feature tracker, and most issues I have are
already there, but with a low priority.
I could try to contribute, but I'm both lazy and unsure I can be of help


 On 3 Aug 2010, at 18:48, David Virebayre wrote:
 Trying code completion in comments on string constants, for example.
 Code completion makes the text jump if you're editing near the bottom
 of the editor area.

 I like the tocandy feature but then it breaks alignment if you open
 the file in another editor. Something probably fixable by editing the
 candy file.

 Just out of interest which of the candy replacements caused problems.  Some 
 of them (such as -) already are set to include spaces to pad out differences.

For example, .

Here's an example without, and with candy :

listeEtageres = flip zip [1..]  -- on les numérote
  . nub -- on élimine les doublons
  . sort-- on les trie
  . map simple  -- on ne garde que le type et la position
  $ listeEtagTot-- on part de la liste totale des étagères
  where simple (_arm,tpe,pos) = (tpe,pos)
f n (t,p) = (n,t,p)

listeEtageres = flip zip [1..]  -- on les numérote
 ∘nub -- on élimine les doublons
 ∘sort-- on les trie
 ∘map simple  -- on ne garde que le type et la position
  $ listeEtagTot-- on part de la liste totale des étagères
  where simple (_arm,tpe,pos) = (tpe,pos)
f n (t,p) = (n,t,p)
---
 Does your existing editor handle candy better? If so how?
It doesn't handle them at all :)


 Thanks for the feedback, please let us know if you think of anything else.

This is an example of how i'm confused.
In this example, I'm trying to load a single file. It's for test
purposes only, I only need it made by ghc --make, I don't need a cabal
package.

$ cd code/euler
$ leksah Euler.hs

leksah loads with my previous package loaded.
Here, I hoped it'd open the file I mentionned on the command line.
Now, I need to close the package or workspace I'm working on, but I'm
not sure which. as there's no such option in the Package menu, I
suppose I have to close the workspace.
I close it, but my source file remains open. I close it.
Since I want to see if 'leksah file' works, I close leksah and I'm
back at the shell.

$ leksah Euler.hs

I back again in leksah, this time with no package/workspace opened,
but my Euler.hs file did not open either.
back to the shell again

$ leksah -v
Leksah the Haskell IDE, version 0.8.0.6

$ leksah --help
Leksah the Haskell IDE Usage: leksah [OPTION...] files...
  -v--version  Show the version number of ide
  -l NAME   --loadSession=NAME Load session
  -h--help Display command line options
  -e Verbosity  --verbosity=Verbosity  One of DEBUG, INFO, NOTICE,
WARNING, ERROR, CRITICAL, ALERT, EMERGENCY

According to this help, I should be able to give it a file on the
commande line, but it seems it does nothing. No message to tell me
what's wrong.
Also, there's an option to load a session. What's a session ? the IDE
tells of workspace and package, how is that related to sessions ?
anyway, back to leksah.

I open my file Euler.hs.

I can't seem to use the browser if I don't define a package.
I click several times the menu Package-New package, but nothing happens
I click also Package-Edit package.
After a few clicks, I try Package-Edit flags and leksah exits without
warning. On the shell, I see
--
Needs an open workspace
Needs an open workspace
No active package to edit
Needs an open workspace
Needs an open workspace
No active package to edit
leksah: Can't get pane
***lost connection
***lost last connection - exiting
leksah-server: ExitSuccess
***lost last connection - waiting
ExitSuccess

So I understand why the package menus didn't work, but there was no
alert while I was in leksah. And it did crash when I clicked on
Package-Edit flags (reproductible)

Now I create a workspace since I have to.
On the browser I still don't have access to my file.
Make workspace does nothing, and tells me nothing. I suspect I need a package.

So I'm creating a package. When I click save, it creates a Main.hs file for me.
Right now I'm kind of annoyed, I just wanted to edit Euler.hs, add
another problem to it, compile, run, and get on with something else.
That's usually where I close leksah, and lauch kate.

For another programs (that compile fine with ghc --make), I didn't
bother making the package. But I had

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread David Virebayre
On Thu, Aug 5, 2010 at 11:35 AM, Henning Thielemann
lemm...@henning-thielemann.de wrote:

 What else shall a rounding function return if not integers?

Getting from 29.84645 to 29.85 isn't rounding ?

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread David Virebayre
On Thu, Aug 5, 2010 at 1:11 PM, John Meacham j...@repetae.net wrote:

 use. This isn't to say ghc is doing the wrong thing, I don't think there
 really is a right thing to do here given the broken class specifications
 in the report.

I often read that the numerical classes are problematic.
At the same time, there are many programs and packages that rely on
Haskell being that way.

What would it take to redesign the numeric class so that the new
design eventually becomes the new Haskell standard ? ( not just an
alternative prelude )
Is it doable at all ?
Would a first step be trying to compile all of hackage with the
numeric prelude and see what breaks ?
If it's doable, how many years would it take to make it happen ?

Just curious.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread David Virebayre
On Thu, Aug 5, 2010 at 1:55 PM, Henning Thielemann
lemm...@henning-thielemann.de wrote:

 It's even worse: The NumericPrelude is in progress, certainly currently
 better than Haskell 98's type classes, but there are known problems.
 Sometimes new numeric types are implemented and require to refine or
 restructure the classes, again. And there are not only problems with the
 numeric type classes, think of Functor, Applicative, Monad, and so on. In my
 opinion before trying to move to an improved numerical type hierarchy we
 should have class aliases designed, implemented and thoroughly tested in
 GHC.


It's sad because the class alias proposal was dropped from Haskell'
two years ago, isn't it ?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] what's the best environment for haskell work?

2010-08-03 Thread David Virebayre
On Mon, Aug 2, 2010 at 4:12 PM, Phyx loneti...@gmail.com wrote:

 I've tried to use leksah but some minor annoying things make it unusable for 
 me.
 I'm curious, what are those minor annoying things?

Trying code completion in comments on string constants, for example.
Code completion makes the text jump if you're editing near the bottom
of the editor area.
I like the tocandy feature but then it breaks alignment if you open
the file in another editor. Something probably fixable by editing the
candy file.
I'am a bit lost between Workspace and Package, especially when all I
want is write a quick single-source haskell program.

That's all I can think of right now, I've exagerated a bit when I said
unusable. Leksah is going to be an awesome editor, it's just not
ready yet for me.

David
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] what's the best environment for haskell work?

2010-08-02 Thread David Virebayre
On Sat, Jul 31, 2010 at 12:07 PM, Rustom Mody rustompm...@gmail.com wrote:
 Do most people who work with haskell use emacs/vi/eclipse or something
 else??

I mostly use kate, with a separate terminal window running ghci.

I've tried to use leksah but some minor annoying things make it
unusable for me.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is 'flip' really necessary?

2010-07-26 Thread David Virebayre
On Sun, Jul 25, 2010 at 11:53 PM, Edward Z. Yang ezy...@mit.edu wrote:

 An interesting alternate spin on flip is infix notation combined with partial
 application, such as:

    (`foobar` 3)

 which is equivalent to

    \x - foobar x 3

 I frequently use this, although the jury's out on whether or not it's more 
 readable.

I had HLint suggest me this :

before :

listeEtagTot = concatMap (flip listeEtagArm cfgTypesTringle) listeArmOrd

after :

listeEtagTot = concatMap (`listeEtagArm` cfgTypesTringle) listeArmOrd


David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Newbie] What to improve in my code

2010-07-19 Thread David Virebayre
On Tue, Jul 13, 2010 at 11:49 PM, Frank1981 frankdewe...@gmail.com wrote:

 First of all: I'm not sure if this question is allowed here. If not, I
 apologize

 I'm trying to solve the following problem: For each word in a text find the
 number of occurences for each unique word in the text.

 i've come up with the following steps to solve this:
  * remove all punctuation except for whitespace and make the text lowercase

A minor point: instead of removing the punctuation, you maybe should
convert it to whitespace.

Otherwise in texts like there was a quick,brown fox (notice the
missing space after the comma) you'll have the word quickbrown
instead of 2 words quick and brown.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Suggestions for an MSc Project?

2010-07-06 Thread David Virebayre
On Sun, Jul 4, 2010 at 10:43 AM, John Smith volderm...@hotmail.com wrote:
 My MSc requires a project dissertation, which is expected to take about 800
 hours. I would like to work on something which is of use to the Haskell
 community. Any suggestions?

I'd love to see something like git-gui for darcs.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What is Haskell unsuitable for?

2010-06-17 Thread David Virebayre
On Thu, Jun 17, 2010 at 3:38 PM, Henning Thielemann
lemm...@henning-thielemann.de wrote:

 On Wed, 16 Jun 2010, Marc Weber wrote:

 Hi Aditya Siram,

 - maybe shell scripting: running ghci takes longer than starting bash.
  Compiling is not always an option because executables are bigger than
  shell scripts or C executables

 Is Hugs better in this respect?

Or JHC ? JHC's executables are small.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How does one get off haskell?

2010-06-17 Thread David Virebayre
2010/6/17 Günther Schmidt gue.schm...@web.de:
 Anyway the problem is that I am totally reluctant to code in anything else
 but haskell. It has always been a problem to me getting up early in the

You're not alone.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What is Haskell unsuitable for?

2010-06-16 Thread David Virebayre
On Wed, Jun 16, 2010 at 8:00 AM, Michael Snoyman mich...@snoyman.com wrote:

 Next you'll say there's no need for anyone to ask whether they prefer
 vi or emacs... ;-)

 Of course *real* programmers use ed. It is the standard editor[1].

*Real* programmers use butterfiles [1].

[1] http://xkcd.com/378/

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What is Haskell unsuitable for?

2010-06-16 Thread David Virebayre
On Wed, Jun 16, 2010 at 11:04 AM, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
 David Virebayre dav.vire+hask...@gmail.com writes:

 *Real* programmers use butterfiles [1].

 If your files are composed of butter, Id hate to see how you store them
 in an efficient manner...

Oh well, at least le ridicule ne tue pas(1)... I'm a typo specialist.


(1) Being ridiculous doesn't kill :)

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] parsec: how to get end location

2010-06-13 Thread David Virebayre
On Mon, Jun 14, 2010 at 12:10 AM, Roman Cheplyaka r...@ro-che.info wrote:
 Of course most parsers don't consume trailing newlines. But I was
 writing general function to use in many places in the code which would
 recover the end location. In most cases it just subtracts 1 from the
 column number, but what if it just happened so that column number is 1?


Parsec can handle state, right ? You could modify the parsers for
white space so they record the beginning position in some state. ( In
a maybe )
Then, modify parseWithLocation to set the state position to nothing,
parse p then if no position has been recorded in the state , use the
current position, else use the position in the state.

Excuse me if this is unclear or confused, it's late :)

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] is there a way to prove the equivalence of these two implementations of (Prelude) break function?

2010-06-08 Thread David Virebayre
On Sun, Jun 6, 2010 at 5:10 AM, Thomas Hartman tphya...@gmail.com wrote:
 Here's two implementations of break, a snappy one from the prelude,
...
 prelbreak p xs = (takeWhile (not . p) xs,dropWhile (not . p) xs) --
 fast, more or less as implemented in prelude iiuc

I had a look at the prelude, and I was surprised to see there's 2 versions,
depending on a flag :

#ifdef USE_REPORT_PRELUDE
break p =  span (not . p)
#else
-- HBC version (stolen)
break _ x...@[]   =  (xs, xs)
break p xs@(x:xs')
  | p x=  ([],xs)
  | otherwise  =  let (ys,zs) = break p xs' in (x:ys,zs)
#endif


I'm curious why is it so, and which version is compiled in the platform or
the ghc binaries.
( my guess is USE_REPORT_PRELUDE compiles functions as defined in the
haskell report, but the other version is faster and used by default. )

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Work on Video Games in Haskell

2010-05-26 Thread David Virebayre
On Wed, May 26, 2010 at 9:23 AM, Lyndon Maydwell maydw...@gmail.com wrote:

 As a side note, how is this project getting around the language
 restrictions apple put in the developer license agreement?

From the project page :

This version uses Apple's official iPhone SDK as its back end compiler.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell] Re: [Haskell-cafe] Work on Video Games in Haskell

2010-05-26 Thread David Virebayre
On Wed, May 26, 2010 at 9:58 AM, Brandon S. Allbery KF8NH
allb...@ece.cmu.edu wrote:

 You might want to reread that license agreement.  Specifically:

 Applications must be originally written in Objective-C, C, C++, or
 JavaScript as executed by the iPhone OS WebKit engine, and only code
 written in C, C++, and Objective-C may compile and directly link
 against the Documented APIs (e.g., Applications that link to
 Documented APIs through an intermediary translation or compatibility
 layer or tool are prohibited)

Ah, yes. Ouch, that's abusive.
Can they tell the difference though ?

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why cannot ghc find a existng module ?

2010-05-11 Thread David Virebayre
On Tue, May 11, 2010 at 10:10 AM, zaxis z_a...@163.com wrote:

 `ghc-pkg list` finds two random packages.  After `ghc-pkg unregsiter` the one
 installed by cabal in ~/.ghc/, all works normally now!

I stopped counting the number of times I've reinstalled GHC because I
forgot to tell cabal to install a package globally. I really should
modify the config file.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] IO (Either a Error) question

2010-05-06 Thread David Virebayre
On Thu, May 6, 2010 at 9:56 AM, Eugene Dzhurinsky b...@redwerk.com wrote:
 On Wed, May 05, 2010 at 02:54:27PM -0700, Ryan Ingram wrote:
 ErrorT is just a newtype wrapper, changing the order/application of
 the type variables.

 newtype ErrorT e m a = ErrorT (m (Either e a))
 runErrorT (ErrorT action) = action

 This gives the bijection:

 ErrorT :: m (Either e a) - ErrorT e m a
 runErrorT :: ErrorT e m a - m (Either e a)

 That syntax is not clear for me - so ErrorT is some sort of function
 (calculation), which takes a monad with type (Either e a) and produces type
 ErrorT e m a ? Basically, i don't understand what does ErrorT :: means - it
 should name the function - but it starts with capital letter?

A constructor can be seen as a function that takes some parameters and
produces a value

for example with the type Maybe a, which has 2 constructors ; Just and Nothing :

Prelude :t Just
Just :: a - Maybe a

the constructor Just is a function that takes a value of type a and
makes a value of type Maybe a.

Prelude :t Just
Just :: a - Maybe a

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] IO (Either a Error) question

2010-05-06 Thread David Virebayre
By the way, I didn't exactly reply your question :

 [...] Basically, i don't understand what does ErrorT :: means - it
 should name the function - but it starts with capital letter?

It's a type signature, it describes the type of ErrorT:

Prelude import Control.Monad.Error
Prelude Control.Monad.Error :t ErrorT
ErrorT :: m (Either e a) - ErrorT e m a

So that says, ErrorT is a value constructor that takes a value of type
m (Either e a) and makes a value of type ErrorT e m a.

Notice that the type constructor and the value constructor have both
the same name ErrorT, I used to get confused by this when I began
learning.

If you type under ghci

Prelude Control.Monad.Error :k ErrorT
ErrorT :: * - (* - *) - * - *

That tells you that ErrorT is a type constructor that takes a type, a
unary type constructor, and a type; and with all this defines a new
type (ErrorT e m a).

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell Weekly News?

2010-04-28 Thread David Virebayre
On Wed, Apr 28, 2010 at 7:47 AM, David Sankel cam...@gmail.com wrote:
 I'm wondering if a monetary incentive would keep the person who does this
 work more accountable. I personally would be willing to contribute to
 continue getting this service. I wonder if there are others as well.

I don't think money would be an incentive for someone that has 7
classes worth of finals and papers to do

Now a time machine.


David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Compressing GHC tarballs with LZMA

2010-04-24 Thread David Virebayre
 How common is support for .xz on the platforms we are interested in here?

 Not very.  dpkg may support it in the future, but that is a somewhat closed
 platform where Debian folks are in charge of both the archive and the tool
 used to unpack it.

Trying to install xz on kubuntu brings a serious warning :

The following packages will be REMOVED:
  lzma
The following NEW packages will be installed:
  xz-utils
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  lzma (due to dpkg)
0 upgraded, 1 newly installed, 1 to remove and 8 not upgraded.
Need to get 173kB of archives.
After this operation, 233kB of additional disk space will be used.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Hackage accounts and real names

2010-04-06 Thread David Virebayre
And another +1 from me too.

Keeping the policy will only achieve that people who want to stay anonymous
will stay away from hackage, and that's not something (IMHO) we should want.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackape package lackage

2010-03-23 Thread David Virebayre
On Mon, Mar 22, 2010 at 5:31 PM, Thomas Davie tom.da...@gmail.com wrote:

 I'd love to see that map normalised by the population of the country – would 
 be interesting to see where Haskell is popular.

Looks like it's very very popular in Alaska :-)

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)

2010-03-12 Thread David Virebayre
On Fri, Mar 12, 2010 at 10:29 AM, Johannes Waldmann
waldm...@imn.htwk-leipzig.de wrote:

 Well, meaningful identifier names is nice, but I think
 here we have a case of the code smell type info embedded in the name.
 Strictness of a function should be expressed in the function's type instead.
 But that seems impossible with Haskell at the moment.
 (At best, we can express strictness of constructors?)
 Hence we have underspecified behaviour:

 Prelude Data.List :t foldl'
 foldl' :: (a - b - a) - a - [b] - a

 Prelude Data.List :t foldl
 foldl :: (a - b - a) - a - [b] - a

Even if we had a syntax to express that the function is strict,
wouldn't we still need two distinct function names for the strict and
lazy case ? In that case, some sort of convention on naming is nice,
because if I want to change a function to its strict version, I know
there's a good chance it's the one that ends with a '

David.

 and need to resort to the awkward workaround via naming conventions.

 Of course Haskell implementations do have some kind of strictness
 information (e.g., in ghc interface files), so it's not impossible
 to define some kind of annotation system.

 Although I did not check what the compiler's strictness info is
 for foldl and fold' - and what was actually needed (at the source level).
 The current textual definition (Data.List API docs: foldl' = a
 strict version of foldl) is not too precise, either.

 Well, I guess there's a huge design space. But it's a huge problem
 (describing/controlling the behaviour of lazy programs).

 Best - J.W.


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)

2010-03-12 Thread David Virebayre
On Fri, Mar 12, 2010 at 12:01 PM, Johannes Waldmann
waldm...@imn.htwk-leipzig.de wrote:
 David Virebayre dav.vire+haskell at gmail.com writes:

 in this case, something like:  Data.List.Strict.fold, Data.List.Lazy.fold

 But then if you need both version, you will have to import them
qualified, which I don't like much.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] OpenSUSE 11.2

2010-02-28 Thread David Virebayre
On Sun, Feb 28, 2010 at 6:30 PM, Andrew Coppin
andrewcop...@btinternet.comwrote:

 Daniel Fischer wrote:



 if [ -z `/bin/echo ${PATH} | /usr/bin/grep cabal` ]

 then
export PATH=/home/andrew/.cabal/bin:$PATH
 fi

 in your .bashrc



 Uh... what?


that snippet supposes you have cabal installed in your home directory under
the directory .cabal. The binary file would be in the bin subdirectory of
.cabal
Names that start with a . are hidden files/directories on linux, by the way.
So the first line checks if you have cabal in your path list. If not, on
the 3rd line it supposes your home directory is /home/andrew and adds the
cabal binary directory to your path list.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] wildcards for type variables?

2010-01-13 Thread David Virebayre
On Wed, Jan 13, 2010 at 12:29 AM, Evan Laforge qdun...@gmail.com wrote:
 Occasionally I have a function with an unused argument, whose type I
 don't want to restrict.  Thus:

 f :: _unused - A - B
 f _ a = b

I probably misunderstood the problem, why not f:: a - A - B

David
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are functional dependencies around to stay?

2009-12-21 Thread David Virebayre
2009/12/21 Günther Schmidt gue.schm...@web.de

 Hi everyone,

 I'm wondering if there is any chance that functional dependencies will not
 be around in the future. I do not actually understand the subject yet as
 such, but I'd like to make sure before I get deeper into it that it's
 something that will be around in the time to come.


My understanding is that they might end up dropped in favor of type
families, and that should happen about when chicken will start growing
teeth.

Obviously, my understanding is probably flawed.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Zumkeller numbers

2009-12-09 Thread David Virebayre
On Wed, Dec 9, 2009 at 11:47 AM, Henning Thielemann
lemm...@henning-thielemann.de wrote:

 Ist der Ruf erst ruiniert, lebt es sich ganz ungeniert. 8-]

 Is there an English translation of it?

Google translate says : If the reputation is ruined, one can live
quite openly.

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is Haskell a Fanatic?

2009-12-04 Thread David Virebayre
On Fri, Dec 4, 2009 at 10:34 AM, Simon Peyton-Jones
simo...@microsoft.com wrote:
 Friends

Amen !
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Optimization with Strings ?

2009-12-03 Thread David Virebayre
On Thu, Dec 3, 2009 at 1:03 PM, Emmanuel CHANTREAU
echant+hask...@maretmanu.org wrote:

 In my futur program, it use a lot of binary trees with strings (words)
 as leaf. There is just arround 1000 words and they will appear a lot of
 times. The program will possibly consume a lot of process and memory
 (it is a mathematics proover).

 I began this program in C++ but haskell has a prety good speed and
 memory footprint and is easier. But I don't know if it worth to do this
 optimization: having a dictionary to translate string words in Int.

 The answer depends on the automatic optimizations in GHC, because GHC
 could compare quickely two strings if it is the same object, so it
 depends if program generated by GHC have a dictionary (tree) of strings
 internaly. Someone knows this ?

It doesn't work this way : Strings are just lists of Chars. Comparison
is made recursively, Char by Char. You can have a look at the source
to make sure :

instance (Eq a) = Eq [a] where
[] == [] = True
(x:xs) == (y:ys) = x == y  xs == ys
_xs== _ys= False

So you will have to code your own optimisation.

David.

P.S. In French if you didn't understand:

Ca ne marche pas comme ça.
Les chaines de caractères ne sont que des listes de caractères.
La comparaison sur les listes est faite récursivement, caractère par
caractère, il suffit pour s'en assurer de regarder au source :
Donc il vaut mieux que tu implémente ton propre dictionnaire.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Typeclasses for name punning (was: Re: I miss OO)

2009-11-27 Thread David Virebayre
2009/11/27 Daniel Schüssler anotheraddr...@gmx.de


 I think punning is a worthwhile goal on its own, since I find myself
 wasting
 quite some thought on whether to prefix a record field name somehow, and if
 I
 do, what I should use as a short but sufficiently unique prefix.


I agree, especially since it looks like the record situation is not about to
be solved; for example by looking at the discussion generated by Simon
Peyton-Jones's TDNR proposal (which I like, but I don't feel like my opinion
should count on that matter )

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Resource compilation in GHC

2009-11-12 Thread David Virebayre
On Thu, Nov 12, 2009 at 11:12 AM, Konstantin Vladimirov
konstantin.vladimi...@gmail.com wrote:
 Hello.

 I'm writing an wxHaskell application. Everything is ok, but now I need
 a separate folder for icons, bitmaps, and so on, from where they are
 loaded at runtime. How can I compile resources, and link them into my
 executable to provide for users single .exe file with resource section
 inside it?

+1 !

I would also like to know how one can do it with gtk2hs.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What does the `forall` mean ?

2009-11-12 Thread David Virebayre
On Thu, Nov 12, 2009 at 8:52 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:

 I just meant it's not immediately clear how

  foo :: forall x. (x - x - y)

 is different from

 foo :: (forall x. x - x) - y

 It takes a bit of getting used to.

That still confuses me.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] faster compiling for ghc

2009-11-11 Thread David Virebayre
On Thu, Nov 12, 2009 at 7:18 AM, Bulat Ziganshin
bulat.zigans...@gmail.com wrote:

 Hello Evan,

 Thursday, November 12, 2009, 4:02:17 AM, you wrote:

  Recently the go language was announced at golang.org.  There's not a
  lot in there to make a haskeller envious, except one real big one:
  compilation speed.  The go compiler is wonderfully speedy.

 are you seen hugs, for example? i think that ghc is slow because it's
 written in haskell and compiled by itself

If I understood, Evan is interested in ideas to speed up compilation.
As far as I know, hugs is an interpreter, not a compiler.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Static Linking Problem

2009-11-11 Thread David Virebayre
On Wed, Nov 11, 2009 at 5:44 PM, Svein Ove Aas svein@aas.no wrote:

 My recommendation would be to take glibc off the list of statically
 linked libraries.

How do you do that ?

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What's the deal with Clean?

2009-11-06 Thread David Virebayre
On Fri, Nov 6, 2009 at 8:45 AM, Ketil Malde ke...@malde.org wrote:


 enough about. I'd be happy to hear any suggestions.


This is more a question than a suggestion, but would the iteratees package
fit your needs ?



David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hoogle is great but ...

2009-10-26 Thread David Virebayre
On Sun, Oct 25, 2009 at 2:09 PM, Curt Sampson c...@starling-software.com 
wrote:
 But zaxis, here's another thing to look at. There's usually a view
 source link beside most of the functions that come up in the Haddock
 documentation to which Hoogle links. It's worth clicking. You would be
 surprised (certainly I was!) at how often looking at the definition
 of a function suddenly makes it quite clear what it does, when the
 description didn't quite do it for you. (This is one of the joys of
 Haskell.)

I tried that with parsec 3, my brain exploded :)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] x - String

2009-10-16 Thread David Virebayre
On Fri, Oct 16, 2009 at 8:19 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:
 Is there any way that you can turn an arbitrary Haskell value into a string?

 I rephrase: There *is* a way to turn arbitrary values into strings. I know
 there is, because the GHCi debugger *does* it. The question is, does anybody
 know of an /easy/ way to do this?

Ghci only displays values with a Show instance.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] GHC devs

2009-10-15 Thread David Virebayre
On Wed, Oct 14, 2009 at 11:06 PM, Bulat Ziganshin
bulat.zigans...@gmail.com wrote:
 Hello Andrew,

 Thursday, October 15, 2009, 12:54:37 AM, you wrote:

 Does anybody actually get paid to develop GHC? Or is this all people

 SPJ, SM and Ian are paid by MS Research. Other people involved in core
 development are mainly scientists (afaik)

Taking the opportunity to thank very much both Simons and Ian for the
work they do and the enthusiasm they show. You guys rock.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] better way to do this?

2009-10-07 Thread David Virebayre
On Wed, Oct 7, 2009 at 10:05 AM, Peter Verswyvelen bugf...@gmail.com wrote:
 over every bit of the system (it was even easy to count exactly how many
 cycles a routine would take :-), so it was just a matter of starting the

You sound like you used to code on the Commodore 64 :)

David.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Curried function terminology

2009-10-06 Thread David Virebayre
On Mon, Oct 5, 2009 at 11:52 AM, Jon Fairbairn
jon.fairba...@cl.cam.ac.uk wrote:

 [1] A pet peeve of mine is x supports y being used backwards (as in
 our application supports windows Vista, which would only make sense if
 it were something like a system tool that stopped Vista crashing.

(Not a native English speaker here)

How would you say  x works well with y ?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe