[Haskell-cafe] Text.XHtml link broken

2007-07-27 Thread Dean Herington
The Haddock documentation for Text.XHtml (at http://www.haskell.org/ghc/docs/latest/html/libraries/xhtml/Text-XHtml.html) refers to http://www.cse.ogi.edu/~andy/html/intro.htm, but that link is broken. Does anyone know where to find the intended document? ___

[Haskell-cafe] Takusen and large PostgreSQL blobs [was: Handling custom types in Takusen]

2007-07-27 Thread oleg
I have been using Takusen with PostgreSQL to store and retrieve hundreds of multi-megabyte binary objects. A client may request literally hundred of such objects in one request; the Haskell (FastCGI) application server will send these objects in one multi-part message. The handling of the entire r

Re: [Haskell-cafe] Space usage and CSE in Haskell

2007-07-27 Thread Melissa O'Neill
Bertram Felgenhauer wrote two wonderful implementations of power_list: power_list :: [a] -> [[a]] power_list [] = [[]] power_list (x:xs) = add_x (assert_first_empty $ power_list xs) x where assert_first_empty ~([]:xs) = []:xs add_x [] _ = [] add_x (y:ys) x

[Haskell-cafe] Using GADTs

2007-07-27 Thread Matthew Pocock
Hi, I'm trying to get to grips with GADTs, and my first attempt was to convert a simple logic language into negative normal form, while attempting to push the knowledge about what consitutes negative normal form into the types. My code is below. I'm not entirely happy with it, and would apprec

Re: [Haskell-cafe] Memory profiler

2007-07-27 Thread Stefan O'Rear
On Sat, Jul 28, 2007 at 12:11:31AM +0100, Jon Harrop wrote: > Is there a memory profiler for Haskell? Yes. GHC, NHC and HBC all have integrated heap profilers. ghc --make -prof -auto-all ... ./MyProgram +RTS -hc -RTS ./MyProgram +RTS -hm -RTS ./MyProgram +RTS -hd -RTS ./MyProgram +RTS -hy -RTS .

[Haskell-cafe] Memory profiler

2007-07-27 Thread Jon Harrop
Is there a memory profiler for Haskell? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists/?e ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/ma

[Haskell-cafe] Re: [Haskell] View patterns in GHC: Request?for?feedback

2007-07-27 Thread Aaron Denney
On 2007-07-27, David Roundy <[EMAIL PROTECTED]> wrote: > The solution is to add explicit to the constructor for all single-argument > constructors (except perhaps occasionally when you actually want explicit > construction of objects). > > The reasoning behind this, of course, is to allow nice inte

Re : [Haskell-cafe] Indentation woes

2007-07-27 Thread anon
2007/7/27, Steve Schafer <[EMAIL PROTECTED]>: > What exactly are you proposing as an alternative rule? If you're > suggesting that _any_ line at the same level of indentation as the > previous line be treated as a continuation of that line, then how would > one go about indicating that a line is _n

[Haskell-cafe] Re: Avoiding boilerplate retrieving GetOpt cmd line args

2007-07-27 Thread Eric Y. Kow
To anyone who followed up on this thread (hi!). I have posted the GetOpt-summary part of my message on the wiki: http://www.haskell.org/haskellwiki/GetOpt Please update it with the relevant parts of your followups, and correct any silliness. Haven't had the time to look, but I'm particularly

Re: Re : [Haskell-cafe] Indentation woes

2007-07-27 Thread Brandon Michael Moore
On Thu, Jul 26, 2007 at 05:34:32PM -0400, anon wrote: > 2007/7/26, Stefan O'Rear <[EMAIL PROTECTED]>: > >As for "why", it's just a matter of Haskell Committee taste. Nothing > >too deep, just an arbitrary set of rules. > That's not much of an explanation, is it? I imagine someone must have > given

[Haskell-cafe] Re: Handling custom types in Takusen

2007-07-27 Thread Benjamin Franksen
Salvatore Insalaco wrote: > I noticed that in Takusen there're just two instances to implement to > make any Haskell type db-serializable: DBBind / SqliteBind for > serialization and DBType for deserialization. FWIW, I have two patches lying around (attached) that I wanted to send to the Takusen m

Re: [Haskell-cafe] Re: [Haskell] View patterns in GHC: Request?for?feedback

2007-07-27 Thread David Roundy
On Fri, Jul 27, 2007 at 09:02:42AM -0500, Jonathan Cast wrote: > On Friday 27 July 2007, Jon Fairbairn wrote: > > ChrisK <[EMAIL PROTECTED]> writes: > > > Because this is starting to sound like one of the > > > maddening things about C++. > > > > > > Namely, the automatic implicit casting conversio

Re: [Haskell-cafe] Re: [Haskell] View patterns in GHC: Request forfeedback

2007-07-27 Thread Jacques Carette
Others have already pointed this out, but it is worth saying again: Maybe is not the only monadic effect which makes sense during pattern-matching. Wolfram Kahl and I have explored some of these things as part of the Pattern Matching Calculus, http://sqrl.mcmaster.ca/~kahl/PMC/ [If you want to

Re: [Haskell-cafe] Handling custom types in Takusen

2007-07-27 Thread Salvatore Insalaco
2007/7/27, Bayley, Alistair <[EMAIL PROTECTED]>: > It was my intention to do it the other way around: marshall blob to Ptr > (), and then you can cast this to a Ptr CChar. Obviously you'd need to > retain the size information, so a blob basically becomes a (Ptr (), Int) > pair, just like a CStringL

RE: [Haskell-cafe] Handling custom types in Takusen

2007-07-27 Thread Bayley, Alistair
> From: Salvatore Insalaco [mailto:[EMAIL PROTECTED] > > 2007/7/27, Bayley, Alistair <[EMAIL PROTECTED]>: > > > Also, in Sqlite 3.4, they introduced new functions for incremental > > > reading / writing of Blobs. I could use them in the future. > > > > Seems reasonable. I recall Oleg saying somet

[Haskell-cafe] Re: Avoiding boilerplate retrieving GetOpt cmd line args

2007-07-27 Thread Dave Bayer
Neil Mitchell gmail.com> writes: > then lookup, instead of just "" as the else clause. Thanks, all. After digesting what was on this thread as I woke up this morning, I ended up writing something rather close to this. I have a reusable wrapper around System.Console.GetOpt that adds > type Opt

Re: [Haskell-cafe] Handling custom types in Takusen

2007-07-27 Thread Salvatore Insalaco
2007/7/27, Bayley, Alistair <[EMAIL PROTECTED]>: > > Also, in Sqlite 3.4, they introduced new functions for incremental > > reading / writing of Blobs. I could use them in the future. > > Seems reasonable. I recall Oleg saying something privately a while ago > about an API for large objects. He may

Re: [Haskell-cafe] Re: [Haskell] View patterns in GHC: Request for feedback

2007-07-27 Thread Stefan O'Rear
On Fri, Jul 27, 2007 at 05:22:37AM -0400, Dan Licata wrote: > On Jul26, Stefan O'Rear wrote: > > > So, this syntax affects a lot of code, existing or otherwise, that > > > doesn't use view patterns, which is something we're trying to avoid. > > > > Eh? I *think* the typing rules are the same for

Re: [Haskell-cafe] Indentation woes

2007-07-27 Thread Steve Schafer
On Fri, 27 Jul 2007 00:33:17 -0400, you wrote: >What makes this a law? If you notice a pattern where beginners trip >against this rule because they don't indent the arms of conditionals >properly inside do blocks, should strict adherence to this principle >take precendence over the intuition of pr

RE: [Haskell-cafe] Handling custom types in Takusen

2007-07-27 Thread Bayley, Alistair
> From: Salvatore Insalaco [mailto:[EMAIL PROTECTED] > > The main reason is that I'm working on a Sqlite back-end for Darcs, > that will be used to store file contents. > I think to choose Takusen as back-end library mainly because it has > the blob functions of Sqlite already mapped. Umm, yes..

Re: [Haskell-cafe] Handling custom types in Takusen

2007-07-27 Thread Salvatore Insalaco
2007/7/27, Bayley, Alistair <[EMAIL PROTECTED]>: > BTW, do you really need to marshall PackedStrings to blobs? The Sqlite > library uses CStrings, and I assume that CString to PackedString > marshaling is fairly efficient, so that would seem to be a better > choice. (I have no experience of PackedS

RE: [Haskell-cafe] Handling custom types in Takusen

2007-07-27 Thread Bayley, Alistair
> I noticed that in Takusen there're just two instances to implement to > make any Haskell type db-serializable: DBBind / SqliteBind for > serialization and DBType for deserialization. > > I wanted to implement blob serialization for PackedStrings, but I > noticed that both DBBind and DBType class

Re: [Haskell-cafe] Avoiding boilerplate retrieving GetOpt cmd line args

2007-07-27 Thread Neil Mitchell
Hi Why not: > data Flag > = Filter String > | DateFormat String > | DocStart String > | DocEnd String Becomes: data Flag = Flag Key String data Key = Filter | DateFormat | DocStart | DocEnd getString :: Flag -> Key -> String getString (Flag x y) key = if key == x then y else "" You ca

Re: [Haskell-cafe] Re: [Haskell] View patterns in GHC: Request for feedback

2007-07-27 Thread Jonathan Cast
On Friday 27 July 2007, Jon Fairbairn wrote: > ChrisK <[EMAIL PROTECTED]> writes: > > Jon Fairbairn wrote: > > > I currently only get f :: [t] -> something, so if I later > > > discover that I need to change the input representation to > > > be more efficient than lists, I have to rewrite f. Wouldn

Re: [Haskell-cafe] Avoiding boilerplate retrieving GetOpt cmd line args

2007-07-27 Thread Jonathan Cast
On Friday 27 July 2007, Dave Bayer wrote: > Ok, I'm writing a command line tool, using System.Console.GetOpt to > handle command line arguments. My Flags structure so far is > > > data Flag > > = Filter String > > > > | DateFormat String > > | DocStart String > > | DocEnd String > >

[Haskell-cafe] Handling custom types in Takusen

2007-07-27 Thread Salvatore Insalaco
Disclaimer: I don't know Takusen very well, and I'm talking of Sqlite backend. I noticed that in Takusen there're just two instances to implement to make any Haskell type db-serializable: DBBind / SqliteBind for serialization and DBType for deserialization. I wanted to implement blob serializatio

[Haskell-cafe] Re: [Haskell] View patterns in GHC: Request for feedback

2007-07-27 Thread Jon Fairbairn
ChrisK <[EMAIL PROTECTED]> writes: > Jon Fairbairn wrote: > > I currently only get f :: [t] -> something, so if I later > > discover that I need to change the input representation to > > be more efficient than lists, I have to rewrite f. Wouldn't > > it be so much nicer if I could simply add a dec

[Haskell-cafe] Ray tracer language comparison

2007-07-27 Thread Jon Harrop
I've added four progressively optimized implementations of the Haskell ray tracer to the language comparison: http://www.ffconsultancy.com/languages/ray_tracer/ Only the first is lazy and I haven't mentioned them in the discussion yet. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. OCaml

[Haskell-cafe] Re: Re: Avoiding boilerplate retrieving GetOpt

2007-07-27 Thread Eric Kow
> For starters, you could squish these down into something like > > flagToString :: Flag -> Maybe String > > flagToString (Filter s) = Just s > > flagToString (DateFormat s) = Just s > > ... > > flagToString _ = Nothing What am I saying?! This wouldn't work! Sorry for the noise. -- Eric Kow

Re: [Haskell-cafe] Re: [Haskell] View patterns in GHC: Request for feedback

2007-07-27 Thread Conor McBride
Me: > > In the dependently typed setting, it's often the case that the > > "with-scrutinee" is an expression of interest precisely because it > > occurs > > in the *type* of the function being defined. Correspondingly, an > > Epigram implementation should (and the Agda 2 implementation now does)

Re: [Haskell-cafe] Re: [Haskell] View patterns in GHC: Request for feedback

2007-07-27 Thread Dan Licata
On Jul26, apfelmus wrote: > Yes, the types of the patterns don't unify. But each one is a > specialization of the argument type. Note that the type signature is > > bar :: (forall a . ViewInt a => a) -> String > > which is very different from > > bar :: forall a . ViewInt a => a -> String >

Re: [Haskell-cafe] Re: [Haskell] View patterns in GHC: Request for feedback

2007-07-27 Thread Dan Licata
On Jul26, Stefan O'Rear wrote: > > So, this syntax affects a lot of code, existing or otherwise, that > > doesn't use view patterns, which is something we're trying to avoid. > > Eh? I *think* the typing rules are the same for the no-view case. If > the auto-deriving hack isn't implemented, you

Re: Re : Re : Re : [Haskell-cafe] Indentation woes

2007-07-27 Thread Dougal Stanton
On 27/07/07, anon <[EMAIL PROTECTED]> wrote: > I see what you did there. But you really might as well end sentences > with prepositions. Or begin them with conjunction. Or indent your code > whichever way seems most natural and elegant because to do otherwise > is just prescriptivism for its own s

Re: [Haskell-cafe] Re: Avoiding boilerplate retrieving GetOpt cmd line args

2007-07-27 Thread Stuart Cook
On 7/27/07, Eric Y. Kow <[EMAIL PROTECTED]> wrote: > Solution #3 No lists, just records (lhs2TeX) > -- > Advantages: > very convenient/compact; have to write > (i) Flag type > (ii) Settings record type/GetOpt in one go > (iii) default Settings > e

[Haskell-cafe] Re: Indentation woes

2007-07-27 Thread Stefan Monnier
> I wish to be able to indent my code like so: >> longFunctionName various and sundry arguments >> | guard1 = body1 >> | guard2 = body2 >> | ... >> where declarations > That is, with guards and where clauses indented to the same level as > the function name. Sounds like a generalization of the ide

[Haskell-cafe] Re: Avoiding boilerplate retrieving GetOpt cmd line args

2007-07-27 Thread Eric Y. Kow
Hi, Here is a possible two part response. Not literate code, just using > to distinguish code from everything else. A short answer == > > getFilter = getString f "Markdown.pl" > > where f (Filter s) = Just s > > f _ = Nothing > > > > getDateFormat = getString f "%B %e,