Re: [Haskell-cafe] Proof in Haskell

2010-12-21 Thread Colin Paul Adams
> "Daniel" == Daniel Fischer  writes:

Daniel> On Tuesday 21 December 2010 19:34:11, Felipe Almeida Lessa wrote:
>> 
> Theorem mirror_mirror : forall A (x : Tree A), mirror (mirror x) = x.
>> induction x; simpl; auto.  rewrite IHx1; rewrite IHx2; trivial.
>> Qed.

Daniel> Since mirror (mirror x) = x doesn't hold in Haskell, I take
Daniel> it that Coq doesn't allow infinite structures?

Why doesn't it hold?
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

___
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-04 Thread Colin Paul Adams
> "David" == David Fox  writes:

David> On Thu, Nov 4, 2010 at 2:41 PM, Albert Y. C. Lai  
wrote:
>> On 10-11-03 10:00 PM, Jonathan Geddes wrote:
>>
>> It's called "The *Ultimate* Computer Language Guide," and it's on the
>>> internets, so it must be correct, right?
>> 
>> The correct conclusion: it's on the internets, so it must be LOL.

David> The stuff that is *not* on the internets must be really
David> awesome - can anyone give me a link to that?

://nearly.ubiquitous.org
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A rant against the blurb on the Haskell front page

2010-10-16 Thread Colin Paul Adams
> "Don" == Don Stewart  writes:

>> Let me explain.
>> 
>> "Haskell is an advanced purely functional programming language."
>> 
>> Good start, if only the "advanced" were replaced with something
>> more characteristic, like "lazy", or "statically typed". Which,
>> BTW, both do not

Don> "lazy" and "statically typed" don't mean much to other
Don> people. They are buzz words that mean nothing to many people.

And "purely functional programming language"?

If they mean anything to many people, it's that the language works
(i.e. functions). What language wouldn't work? 

I think Ben has a strong point here.
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Colin Paul Adams
> "Max" == Max Bolingbroke  writes:

Prelude> (if then "Haskell" else "Cafe") False
Max> "Cafe"

My reaction is to ask:

Can you write this as:

(if then else) False  "Haskell"  "Cafe"

?
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: AbortT-transformers version 1.0

2010-09-08 Thread Colin Paul Adams
> "Henning" == Henning Thielemann  writes:

Henning> On Wed, 8 Sep 2010, Gregory Crosswhite wrote:

> ExceptionT is a different matter because it handles "fail" as an
>> uncaught error and places no restrictions on the error type, so
>> one could implement the same functionality as AbortT by using
>> ExceptionalT and requiring the end result be a monadic value of
>> type "ExceptionalT e m e", where the exception and result types
>> are the same.  However, I believe that it is better to have the
>> AbortT functionality available as a separate simple library
>> specialized for this purpose than to have its functionality
>> buried inside a more general library that is really intended to
>> be used for a different purpose.

Henning> If we get rid of the notion of an exception as being
Henning> something bad, and instead consider an exception as being
Henning> early exit for whatever reason, I see no problem. E.g. you
Henning> may well use an exception to terminate a successful search,
Henning> returning the search result as exception value.

So where is the exceptional nature? Is a successful conclusion to a
search so exceptional?

It seems to me that you want to get rid of the notion of an exception as
something exceptional, in which case it would be better to give it a
different name.
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: String vs ByteString

2010-08-17 Thread Colin Paul Adams
> "Johan" == Johan Tibell  writes:

Johan> On Tue, Aug 17, 2010 at 1:36 PM, Tako Schotanus  
wrote:
Johan> Yeah, I tried looking it up but I could find the
Johan> technical definition for Char, but in the end I found that
Johan> "maxBound" was "0x10" making it basically 24 bits :)


Johan> I think that's enough to represent all the assigned Unicode
Johan> code points. I also think the Unicode consortium (or whatever
Johan> it is called) made some statement about the maximum number of
Johan> bits they'll ever use.

Yes. And UTF-16 is only capable of dealing with codepoints up to this limit.
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: String vs ByteString

2010-08-17 Thread Colin Paul Adams
> "Ivan" == Ivan Lazar Miljenovic  writes:

> Char is not an encoding, right?

Ivan> No, but in GHC at least it corresponds to a Unicode codepoint.

I don't think this is right, or shouldn't be right, anyway.. Surely it
stands for a character. Unicode codepoints include non-characters such
as the surrogate codepoints used by UTF-16 to map non-BMP codepoints to
pairs of 16-bit codepoints. 

I don't think you ought to be able to see a surrogate codepoint as a Char.
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: String vs ByteString

2010-08-17 Thread Colin Paul Adams
> "Ketil" == Ketil Malde  writes:

Ketil> Johan Tibell  writes:
>> It's not clear to me that using UTF-16 internally does make
>> Data.Text noticeably slower.


Ketil> I think that *IF* we are aiming for a single, grand, unified
Ketil> text library to Rule Them All, it needs to use UTF-8.
Ketil> Alternatively, we can have different libraries with different
Ketil> representations for different purposes, where you'll get
Ketil> another few percent of juice by switching to the most
Ketil> appropriate.

Why not instead allow the programmer to decide at the function level
which internal encoding to use?
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: String vs ByteString

2010-08-15 Thread Colin Paul Adams
> "Bryan" == Bryan O'Sullivan  writes:

Bryan> On Sat, Aug 14, 2010 at 10:46 PM, Michael Snoyman 
 wrote:
Bryan> When I'm writing a web app, my code is sitting on a Linux
Bryan> system where the default encoding is UTF-8, communicating
Bryan> with a database speaking UTF-8, receiving request bodies in
Bryan> UTF-8 and sending response bodies in UTF-8. So converting all
Bryan> of that data to UTF-16, just to be converted right back to
Bryan> UTF-8, does seem strange for that purpose.


Bryan> Bear in mind that much of the data you're working with can't
Bryan> be readily trusted. UTF-8 coming from the filesystem, the
Bryan> network, and often the database may not be valid. The cost of
Bryan> validating it isn't all that different from the cost of
Bryan> converting it to UTF-16.

But UTF-16 (apart from being an abomination for creating a hole in the
codepoint space and making it impossible to ever etxend it) is slow to
process compared with UTF-32 - you can't get the nth character in
constant time, so it seems an odd choice to me.
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
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-03 Thread Colin Paul Adams
> "Alexander" == Alexander Solla  writes:

Alexander> On Aug 3, 2010, at 2:51 PM, aditya siram wrote:

> I am looking for suggestions on how to introduce the concept and its
>> implications. I'd also like to include a section on why monads
>> exist and why we don't really see them outside of Haskell.

Alexander> Start with functors (things that attach
Alexander> values/functions/functors to values in an algebra).  Move
Alexander> on to applicative functors (functors that can interpret
Alexander> the thing that is getting things attached to it).  Move
Alexander> on to monads

Too late! The audience has already dozed off.

Alexander> (applicative functors where you can
Alexander> explicitly control the order of
Alexander> evaluation/interpretation).


-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-07-30 Thread Colin Paul Adams
> "Kevin" == Kevin Jardine  writes:

Kevin> The more I learn about monads, however, the less I understand
Kevin> them.  I've seen plenty of comments suggesting that monads
Kevin> are easy to understand, but for me they are not.

I used to have the same problem.

Then I read:

http://ertes.de/articles/monads.html

and after that it was very clear.
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] DTP10 Call for Participation

2010-05-06 Thread Colin Paul Adams
> "Conor" == Conor McBride  writes:

Conor> Remember, Haskell is the world's most popular dependently
Conor> typed functional programming language...

Could you justify that claim please?
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell and the Software design process

2010-05-04 Thread Colin Paul Adams
> "aditya" == aditya siram  writes:

aditya> This is awesome! GHC-devs , please mainline the CONTRACT
aditya> pragma. 

I think it needs a LOT more work before it is usable. (I hope I'm wrong,
but Dana reckoned it needed about 7 more man-years of work.)

Dana sent me a copy of her ghc 6.8 repository (which didn't compile), and I 
updated (by hand) a
6.11 repository. I was able to get a few test programs to be rejected as
not fulfilling their contracts (due to type classes), and a few others
to loop at compile time, but I couldn't find any that passed.

I was supposed to have a go at debugging the loops, but never got round
to it.
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
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 Colin Paul Adams
> "Pekka" == Pekka Enberg  writes:

Pekka> On Tue, Apr 6, 2010 at 7:32 AM, Ivan Miljenovic
Pekka>  wrote:
>> 5) No-one is convincing anyone else to their point of view, so we
>> have a stale mate.

Pekka> Can you really legally distribute your software under an open
Pekka> source license if you don't use your real name?

Well, yes, you can.
The FSF has always suggested that you can assign the copyright of your
GPL'ed software to them, in some circumstances.

Note I'm very much pro the real-name policy in principle, but I don't
see how it can be enforced. 
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] chp-plus doesn't install

2010-03-28 Thread Colin Paul Adams
> "Neil" == Neil Brown  writes:

Neil> That did indeed turn out to be the fix.  That will teach me to
Neil> release a package without remembering to test it on GHC 6.10
Neil> first.  I've uploaded chp-plus 1.2.0 to Hackage, which should
Neil> fix this issue (among other changes).  So:

Neil> cabal update && cabal install chp-plus

Neil> Should work now.  Let me know if you have any other troubles.

Yes, I was able to compile and run the first program in the tutorial.

Thanks.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] chp-plus doesn't install

2010-03-27 Thread Colin Paul Adams
I'm getting these errors (ghc 6.10.4 on Linux x86_64):

Building chp-plus-1.1.0...
[1 of 9] Compiling Control.Concurrent.CHP.Test ( 
Control/Concurrent/CHP/Test.hs, dist/build/Control/Concurrent/CHP/Test.o )
[2 of 9] Compiling Control.Concurrent.CHP.Console ( 
Control/Concurrent/CHP/Console.hs, dist/build/Control/Concurrent/CHP/Console.o )
[3 of 9] Compiling Control.Concurrent.CHP.Connect ( 
Control/Concurrent/CHP/Connect.hs, dist/build/Control/Concurrent/CHP/Connect.o )

Control/Concurrent/CHP/Connect.hs:146:67:
Couldn't match expected type `ChanOpts a'
   against inferred type `ConnectableParam (Chanout a)'
In the first argument of `oneToOneChannel'', namely `o'
In the second argument of `(<$>)', namely `oneToOneChannel' o'
In the first argument of `(>>=)', namely
`((writer &&& reader) <$> oneToOneChannel' o)'

Control/Concurrent/CHP/Connect.hs:152:67:
Couldn't match expected type `ChanOpts a'
   against inferred type `ConnectableParam (Chanin a)'
In the first argument of `oneToOneChannel'', namely `o'
In the second argument of `(<$>)', namely `oneToOneChannel' o'
In the first argument of `(>>=)', namely
`((reader &&& writer) <$> oneToOneChannel' o)'

etc.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Internet game servers in Haskell?

2010-03-27 Thread Colin Paul Adams
Has anyone ever written a server in Haskell for managing live
game-playing (any game) across the internet?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Parallel Pi

2010-03-19 Thread Colin Paul Adams
> "Ketil" == Ketil Malde  writes:

Ketil> I think the general consensus was a 10-15% speedup from HT.

I used to see 3-core performance from my twin hyper-threaded Xeons, when
running C compiles (i.e. 50% speed-up).
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell and XML, need some tips from practioners

2010-02-25 Thread Colin Paul Adams
> "Günther" == Günther Schmidt  writes:

Günther> Dear Alistair, after working intensely with XSLT again
Günther> (with a break for several years), I wholeheartedly concur.

Günther> You guys are right though, through the document function it
Günther> would be possible.

Günther> So any particular tool-set you could recommend?

Saxon is by far the best, if you're happy with a java program.
(I can hardly recommend my own. Not through modesty, of which I am not
over-endowed, but because I refuse to support it since the W3C abolished
the concept of XML as self-describing data.)
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell and XML, need some tips from practioners

2010-02-25 Thread Colin Paul Adams
> "Günther" == Günther Schmidt  writes:

Günther> But now I need to amend the attributes of some elements
Günther> with looked up values from the outside, the lookup-key is a
Günther> particular attribute value of the nodes. This I cannot do
Günther> through xslt processing as the information needed is not
Günther> within the xml document.

You probably can. Via implementing some custom URI resolver, or an
extension function, or such like. 
Depending upon the xslt implementation.

Not that I'm discouraging you from doing it in Haskell instead.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: haskelldb in-memory driver?

2010-02-09 Thread Colin Paul Adams
> "Günther" == Günther Schmidt  writes:

Günther> Hello Johannes, no, sorry, HaskellDB is only meant for RDBM
Günther> back ends, it eventually generates SQL (Strings).

I recall that there WAS an experimental in-memory backend. 
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Stack ADT?

2010-02-05 Thread Colin Paul Adams
> "Casey" == Casey Hawthorne  writes:

Casey> You could also implement stacks with mutable data structures,
Casey> e.g.  STArray, etc.

Casey> What do you want to use a stack ADT for?

BTW, There is a Myers stack in Edison.
Disclaimer - I don't know what a Myers stack is.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: programmatic DB interface?

2010-02-05 Thread Colin Paul Adams
> "Johannes" == Johannes Waldmann  writes:

>> That is exactly the problem - it is wrong for CalendarT.

Johannes> what do you mean by "it" ... what package should be fixed
Johannes> (old-locale, haskelldb-hdbc-postgreqsl, ...)?  Because
Johannes> obviously something seems broken here.

"It" is the use of unzoned times. I sent the following patch to the
haskelldb list several months ago. But there has not been a new release
since then.

Colin> It is just the code to generate the SQL for CREATE TABLE is
Colin> presumably faulty. For CalendarTimeT columns it should
Colin> generate a time of

Colin> timestamp with time zone

Colin> as CalendarTime is a zoned timestamp.

here's my patch:

--- Default.hs~ 2009-02-13 23:06:25.0 +
+++ Default.hs  2009-10-01 16:43:34.0 +0100
@@ -92,7 +92,7 @@
   IntegerT  -> SqlType "bigint"
   DoubleT   -> SqlType "double precision"
   BoolT -> SqlType "bit"
-  CalendarTimeT -> SqlType "timestamp"
+  CalendarTimeT -> SqlType "timestamp with time zone"
   BStrT a   -> SqlType1 "varchar" a
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: programmatic DB interface?

2010-02-05 Thread Colin Paul Adams
> "Johannes" == Johannes Waldmann  writes:

Johannes> Michael Snoyman  snoyman.com> writes:
>> Did you append an empty string in the SELECT statement?

Johannes> Magnus says 1. is wrong, but I don't see how the DB server
Johannes> could be convinced to send the ...T...Z format.  In my
Johannes> application, the table definition contains 'timestamp
Johannes> without time zone' and I cannot change that.

That is exactly the problem - it is wrong for CalendarT.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: programmatic DB interface?

2010-02-04 Thread Colin Paul Adams
> "Johannes" == Johannes Waldmann  writes:

Johannes> anyone know what's happening here?  I get this when
Johannes> executing a query via haskelldb-hdbc-postgresql-0.12 (The
Johannes> date is actually in the DB, so it's not a connection
Johannes> problem.)

Johannes> Convertible: error converting source data SqlString
Johannes> "2008-10-29 00:00:00" of type SqlValue to type
Johannes> Data.Time.LocalTime.LocalTime.LocalTime: Cannot parse
Johannes> using default format string "%Y-%m-%dT%T%Q"

I had this sort of problem. I sent a patch on the haskell-db list to use
UTC - I believe the release behaviour is incorrect.

You might check the list archives, as they have a better memory than I.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HTML - based GUIs - follow up

2010-01-20 Thread Colin Paul Adams
> "Günther" == Günther Schmidt  writes:

Günther> My question is: do formlets only work server based or is it
Günther> also possible to use formlet sans happs?

Yes (I think) and yes.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Language simplicity

2010-01-14 Thread Colin Paul Adams
> "Roel" == Roel van Dijk  writes:

Roel> I think it is time for an Obfuscated Haskell Contest :-)

Are you allowed to use obsolete scripts for your identifiers? :-)
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Language simplicity

2010-01-13 Thread Colin Paul Adams
> "Tom" == Tom Tobin  writes:

Tom> readability.  The ASCII characters are universal and easily
Tom> recognized

No they are not.
My wife is Chinese. When she was learning pinyin as a child, she asked
her father for help with some homework. He replied that he didn't
understand them.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Language simplicity

2010-01-12 Thread Colin Paul Adams
> "Andrew" == Andrew Coppin  writes:

Andrew> It's weird that us Haskell people complain about there
Andrew> being only 26 letters in the alphabet

Which alphabet?
You have plenty of choice in Unicode.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-16 Thread Colin Paul Adams
> "Daniel" == Daniel Fischer  writes:

Daniel> Database.Haskell_DB.Sql.Postgre_SQL

Actually, I would be semi-happy with Database.Haskell-DB.Sql.Postgre-SQL

(obviously we need an option whether to use hypens or underscores. I
prefer hyphens.)

Daniel> Data.Bits.shiftL

Daniel> would that be preferred as

Daniel> shiftL

Daniel> shift_L

Daniel> shift_l

I think I prefer shift-left :-)
I'd settle for the last.

Daniel> Generally, when shall we flatten the hump, 1) always --
Daniel> not 2) unless followed by an uppercase letter 3) when
Daniel> followed by a lowercase letter

I'm nit sure. i think a more sophisticated rule might be needed.

Daniel> feedO'Houlihan?

Daniel> IMO, it should clearly go to feed_O'Houlihan

Yes, I think so.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-16 Thread Colin Paul Adams
> "Daniel" == Daniel Fischer  writes:

Daniel> As a pre-alpha version:

Daniel> 
Daniel> module Main (main) where

Daniel> import Data.Char (isUpper, isLower, toLower)

Daniel> main :: IO () main = interact unCamel

Daniel> unCamel :: String -> String unCamel ('<':cs) = '<' : inTag
Daniel> cs unCamel (a:bs@(b:cs)) | isLower a && isUpper b = a :
Daniel> '_' : toLower b : unCamel cs | otherwise = a : unCamel bs
Daniel> unCamel cs = cs

Daniel> inTag :: String -> String inTag ('>':cs) = '>' : unCamel
Daniel> cs inTag (a:cs) = a : inTag cs inTag [] =
Daniel> [] 

Daniel> Compile, run with

Daniel> ./unCamel < /path/to/HaddockOutput.html >
Daniel> /path/to/Haddock_output.html

Daniel> (or whatever Windows uses to redirect stdin and stdout)
Daniel> This makes a few not-well-founded assumptions about
Daniel> haddock's output. Try it on a couple of files, report
Daniel> bugs.

I tried it.
I'm not all that happy with the resulting uncameling.

For instance,

Database.HaskellDB.Sql.PostgreSQL

goes to

Database.Haskell_dB.Sql.Postgre_sQL

which is uglier than before.

I.m not sure how I would write this going the other way, using
Richard's hspp pre-processor.

I'd want to write Database.Haskell_DB.Sql.Postgresql, but I'd guess
I'd have to write it as Database.Haskell_DB.Sql.Postgre_s_q_l or just
Database.Haskell_DB.Sql.PostgreSQL :-(

Anyway, I'm having trouble with using Richard hspp. It changes ok_url
to okUrl, but in fact the function concerned is named ok_url in
Network.URL, so the pre-processor would have to be applied as part of
cabal install for all packages. 

I don't think it's practical to edit all the .cabal packages as they
come in to say:

ghc-options: -F -pgmF hspp

and cabal install does not recognize this line if I add to to my
~/.cabal/config file.

Duncan, is there a way this can be done?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-16 Thread Colin Paul Adams
> "Ketil" == Ketil Malde  writes:

>> [1] and quite a high proportion of other natural languages.

Ketil> Which makes me wonder - might there be a (natural) language
Ketil> bias as well?

Sure.

Different languages have different orthographical traditions.

IMHO a project should adopt the styles of the natural language it
uses for comments (assuming that the project leader has mandated a
language for comments).

The Haskell standard libraries don't do this.

There is also the question of whether a programming language should be
adaptable to the natural language used in a project (e.g. spelling of
keywords). I have tried to advocate that it should, several times in
the past. But no-one has ever agreed with me on this.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-15 Thread Colin Paul Adams
> "Daniel" == Daniel Fischer  writes:


Daniel> Now, would you be interested in a transformation the other
Daniel> way round, so that you can read other people's code in
Daniel> your preferred style?

I would, applied to the output of haddock, at least.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Re: Allowing hyphens in identifiers

2009-12-15 Thread Colin Paul Adams
> "Richard" == Richard O'Keefe  writes:

Richard> The real point is that the revised version, with command
Richard> line arguments and all, is still just 52 SLOC.  (41 if
Richard> you don't count type specifications the compiler could
Richard> have inferred or the two import directives.)

This looks really good.

When I first started writing Haskell seriously, just over a year ago,
I wrote with underscores, but the mix of style caused by the standard
library names was so disconcerting that
IReluctantlySwitchedToHumpyIlliterateStyle (though not for comments,
where I stuck to standard English punctuation).

So I welcome this chance to switch to natural English style (hyphens).

The main that puzzles me at the moment is how to write a cabal
file. That is, I can specify the ghc options to invoke the
preprocessor in the cabal file, but this supposes the compiled program
is available on the system concerned. This won't necessarily be the
case if I distribute code written in this style on hackage.

So the answer seems to be to release this preprocessor on  hackage,
and then make it a dependcy. But can a library depend upon an
executable program? looking at the Cabal users guide, I can't see
anywhere that says it can't.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-11 Thread Colin Paul Adams
> "Malcolm" == Malcolm Wallace  writes:

>> there is enough experimentally determined about reading in
>> general to be certain that visible gaps between words
>> materially improves readability, and internal capital letters
>> harm it.

Malcolm> Here is a (slightly mischievous) proposal.

Malcolm> Allow the Unicode non-breaking space character (  in
Malcolm> HTML) as a valid character in a varid or conid.

Malcolm> :-)

I thought of that one too (seriously). It has the disadvantage that
the syntax is ambiguous to the human eye without tool support
(e.g. highlighting). On the other hand humans are good at coping with
such ambiguity (we do it all the time in spoken language - and delight
in puns. And in written language, set is indistinguishable from set,
which is indistinguishable from set, which ... - to however many
distinct meanings for the word set are currently recognized).
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Logistic regression

2009-11-16 Thread Colin Paul Adams
Is there any free code anywhere for performing logistic regression? I
can't see anything on hackage.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Trouble installing HDBC 2.1.1 with ghc 6.10.4

2009-11-15 Thread Colin Paul Adams
I'm seeing messages such as:

Database/HDBC/SqlValue.hs:610:32:
  No instance for (Typeable Day) 

Is this connected with the in-and-out status of the time library in
the GHC 6.10.x series?

Is there a work-around?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Pattern Matching

2009-11-13 Thread Colin Paul Adams
> "Andrew" == Andrew Coppin  writes:

Andrew> Casey Hawthorne wrote:
>> Why in a pattern match like
>> 
>> score (1 3) = 7
>> 
>> can I not have
>> 
>> sizeMax = 3
>> 
>> score (1 sizeMax) = 7
>> 

If I had a dollar for every time I've written something like

Andrew>  case msg of eVENT_QUIT -> ...  eVENT_POST -> ...
Andrew> eVENT_RESIZE -> ...

Andrew> and spent an hour trying to figure out why the messages
Andrew> aren't being processed right... ;-)

So why aren't they?


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


Re: [Haskell-cafe] ANN: hesql

2009-11-12 Thread Colin Paul Adams
> "Christoph" == Christoph Bauer  writes:

Christoph> Hello, sure, your program could use a database with
Christoph> HDBC. But I'll guess (since you love static typing so
Christoph> much) you dislike formulating queries in strings and to
Christoph> check the positions of your ?-placeholders and to
Christoph> convert your values with fromSql/toSql.

You guess right.
That's why I use HaskellDB.

Why would hesql be an improvement for me? It sounds like several steps 
backwards?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell image libraries

2009-11-08 Thread Colin Paul Adams
> "Jeremy" == Jeremy Shaw  writes:

Jeremy> There is a partial binding to libgd:
Jeremy> 
http://hackage.haskell.org/packages/archive/gd/3000.4.0/doc/html/Graphics-GD.html

Jeremy> http://www.libgd.org/Main_Page

Jeremy> But GD itself may not do what you want.

I ended up using this myself, but it is an unsatisfactory compromise
(no support for TIFF - and many other formats, trashes EXIF
information). In my innocence I had imagined that GTK (the GIMP
ToolKit) would provide all the image manipulation facilities that the
GIMP offers. But no.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell image libraries

2009-11-08 Thread Colin Paul Adams
> "Max" == Max Rabkin  writes:

Max> Haskellers, To add image support to fdo-notify, I need an
Max> image type. Looking through Hackage, I didn't find any image
Max> library with the following features: * Load from a variety of
Max> formats (at least PNG and JPG, I'd say) * Efficient per-pixel
Max> access, or a way to dump the image into a ByteString as a
Max> bitmap (I need to serialise them into the protocol's bitmap
Max> format) Preferably, it should be possible to construct images
Max> programmatically too.

Max> Is there really no such library? It would be nice to have
Max> something like a Haskell equivalent of the Python Imaging
Max> Library, which is the de facto standard image library in
Max> Python and supports just about every type of operation on
Max> images you could ask for.

I've found nothing either, having searched recently.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to fulfill the "code-reuse" destiny of OOP?

2009-10-30 Thread Colin Paul Adams
> "Magnus" == Magnus Therning  writes:

Magnus> It seems I was wrong in my assumption about "data
Magnus> inheritance", "implementation inheritance" is just as
Magnus> evil.

Both are fine.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: haskell-mode 2.5

2009-10-27 Thread Colin Paul Adams
> "Svein" == Svein Ove Aas  writes:

Svein> Known bugs: * Occasionally, the haskell-indentation parser
Svein> will get stuck   on what it considers to be invalid haskell

Quite often.

Svein> code, and refuse to accept your commands; this includes,
Svein> mainly, haskell-newline-and-indent. To avoid annoyance, if
Svein> you bind RET to haskell-newline-and-indent, you should bind

I don't, but haskell-indentation.el does.

Svein> M-RET to plain newline.

So perhaps the mode should also do this? here's a patch:

-- haskell-indentation.el~  2009-10-27 19:27:40.0 +
+++ haskell-indentation.el  2009-10-27 19:29:43.0 +
@@ -67,7 +67,7 @@
 (defconst haskell-indentation-mode-map
   (let ((keymap (make-sparse-keymap)))
 (define-key keymap [?\r] 'haskell-newline-and-indent)
-(define-key keymap [?\M-r] 'newline)
+(define-key keymap [?\M-\r] 'newline)
 (define-key keymap [backspace] 'haskell-indentation-delete-backward-char)
 (define-key keymap [?\C-d] 'haskell-indentation-delete-char)
 keymap))

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


Re: [Haskell-cafe] A 3 line program --> Reid, Don, Daniel

2009-10-26 Thread Colin Paul Adams
> "Brandon" == Brandon S Allbery KF8NH  writes:

Brandon> That would be the Haskell98 Report: Haskell uses the
Brandon> Unicode [11] character set. However, source programs are
Brandon> currently biased toward the ASCII character set used in
Brandon> earlier versions of Haskell .

Brandon> So yes, it's reasonable to "blame" the language (spec).

Note also that it mentions the Unicode character set, not a particular
Unicode encoding scheme.

To me that implies that an implementation must support all 7 encoding
schemes, not just UTF-8.

At which point you probably want to make use of iconv, so you might as
well support all iconv-supported encodings.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-25 Thread Colin Paul Adams
> "Magnus" == Magnus Therning  writes:

Magnus> Again, in my own experience the amount of work to find a
Magnus> good developer is about the same, and sometimes stacked in
Magnus> favour of using an obscure language.

I would be inclined to agree with you.

Coming from the other end, as someone who has spent the last 7 years
as an Eiffel developer (Haskell is only something I can do in my spare
time), I believe that the company I work for has no problem finding
good Eiffel developers (or just good developers who can be expected to
learn Eiffel quickly). I think the risk is rather on the developer
than the company. 

Suppose the company I work for were to go under in the near future (in
the current economic climate, that can't be ruled out). Since they are
probably the last company employing any significant number of Eiffel
developers, I would probably find it very difficult indeed to find
another job as an Eiffel developer, so I would have to look elsewhere,
encumbered by a CV that did not show recent work in popular languages.

Probably the risk for Haskell developers would be less, since Haskell
popularity is rising, rather than falling. But it is certainly a
consideration I would have thought (not that I ever thought about it
seriously when accepting an Eiffel job - I'm an enthusiast - though
now more for Haskell). 
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] why cannot i get the value of a IORef variable ?

2009-10-22 Thread Colin Paul Adams
> "Gregory" == Gregory Crosswhite  writes:

Gregory> Yes, I was once taught that "Every time you use
Gregory> unsafePerformIO, God kills a kitten," so every time I
Gregory> consider using it I first ask myself: is this really
Gregory> worth an innocent kitten's life?

I've changed my mind.

Everyone go out and use unsafePerformIO all the time. That way we can
get rid of all those mudering kittens, and the dragonflies will live longer.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] why cannot i get the value of a IORef variable ?

2009-10-21 Thread Colin Paul Adams

zaxis> thank you! In fact i really donot understand
zaxis> "unsafePerformIO" very much !

Then all you have to understand is - never use it! 
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What *is* a DSL?

2009-10-09 Thread Colin Paul Adams
>>>>> "Gregg" == Gregg Reynolds  writes:

Gregg> On Thu, Oct 8, 2009 at 6:08 AM, Colin Paul Adams
Gregg> wrote:

> >>>>> "George" == George Pollard  writes:
>> 
George> I'd also like to note that the canonical pronunciation of
George> DSL ends in "-izzle".
>> 
>> Whose canon?
>> 
>> Interestingly, I have always assumed the canonical
>> pronunciation of DSSSL was diesel, as JADE stands for JAmes's
>> DSSSL Engine.
>> 
>> I don't see why removing extra S-es should shorten the vowel.
>> 
>> Wht vwl?  U mst b Englsh. 2 n Amrcn, DSSSL is "dissel"; all
>> short vowels.

Certainly I am English, and so is James Clark.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What *is* a DSL?

2009-10-08 Thread Colin Paul Adams
> "George" == George Pollard  writes:

George> I'd also like to note that the canonical pronunciation of
George> DSL ends in "-izzle".

Whose canon?

Interestingly, I have always assumed the canonical pronunciation of
DSSSL was diesel, as JADE stands for JAmes's DSSSL Engine.

I don't see why removing extra S-es should shorten the vowel.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] dsl and gui toolkit

2009-10-06 Thread Colin Paul Adams
> "John" == John A De Goes  writes:

John> This is the right approach to a GUI toolkit.

John> Note that personally, I believe the details of the
John> presentation should be separate from Haskell, stored in a
John> separate file that is machine- friendly, so designers can
John> work in concert and in parallel with developers.

Like CSS?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Where do these warnings come from?

2009-10-04 Thread Colin Paul Adams
>>>>> "Anton" == Anton van Straaten  writes:

    Anton> Colin Paul Adams wrote:
>> Does anyone recognize which module/function would emit the
>> following warnings?
>> 
>> WARNING: nonstandard use of escape in a string literal LINE 11:
>> '# Pandoc\r\n\r\nPandoc is a program for converting ...  ^
>> HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.

Anton> PostgreSQL.  Perhaps you're trying to save that text in a
Anton> database?

Yes, thanks. I am.
Is it safe to just ignore the warnings, or do I need to run some
function over the strings before saving, and the reverse when restoring?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Where do these warnings come from?

2009-10-04 Thread Colin Paul Adams
Does anyone recognize which module/function would emit the following
warnings?

WARNING:  nonstandard use of escape in a string literal
LINE 11: '# Pandoc\r\n\r\nPandoc is a program for converting ...
 ^
HINT:  Use the escape string syntax for escapes, e.g., E'\r\n'.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: SourceGraph-0.5.0.0

2009-09-29 Thread Colin Paul Adams
>>>>> "Ivan" == Ivan Lazar Miljenovic  writes:

    Ivan> Colin Paul Adams  writes: Compare
Ivan> the version in the subject to the version you're trying to
Ivan> install...

You are right. i forgot to do a cabal update first.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: SourceGraph-0.5.0.0

2009-09-29 Thread Colin Paul Adams
> "Ivan" == Ivan Lazar Miljenovic  writes:

Ivan> I'd appreciate it if people could give SourceGraph a whirl

Fails to install (Linux x86_64):

Data/Graph/Analysis/Utils.hs:207:43:
Ambiguous occurrence `dotizeGraph'
It could refer to either `Data.Graph.Analysis.Utils.dotizeGraph', defined 
at Data/Graph/Analysis/Utils.hs:199:0
  or `Data.GraphViz.dotizeGraph', imported from 
Data.GraphViz at Data/Graph/Analysis/Utils.hs:81:0-19

Data/Graph/Analysis/Utils.hs:220:18:
Not in scope: data constructor `PointList'
cabal: Error: some packages failed to install:
Graphalyze-0.5 failed during the building phase. The exception was:
exit: ExitFailure 1
SourceGraph-0.3 depends on Graphalyze-0.5 which failed to install.

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


Re: [Haskell-cafe] Comments requested: succ Java

2009-09-28 Thread Colin Paul Adams
> "Michael" == Michael Snoyman  writes:

Michael> not be written in pure Haskell, but then again I'm not
Michael> sure if there are any fully W3 compliant browsers *not*
Michael> written in C++.

I'm not sure if there are any fully W3 compliant browsers.
How could there be? It would mean consistent W3C recommendations.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Processing EXIF data with Haskell

2009-09-27 Thread Colin Paul Adams
> "Don" == Don Stewart  writes:

Don> colin:
>> I'm writing web software for a photograph gallery. I want to be
>> able to display selective fields from the EXIF data. I thought
>> I would be able to use the GD and exif libraries from Hackage
>> to do this. However:
>> 
>> Calling Graphics.GD.loadJpegByteString followed by
>> Graphics.GD.saveJpegFile does not preserve the EXIF fields of
>> the uploaded file, but instead writes some new ones (many fewer
>> fields than the original, and nothing of interest).
>> 
>> Graphics.Exif.allTags shows an interesting subset of the
>> original EXIF data, but nothing from the version saved by GD.
>> 
>> Can anyone shed any light on any of this?

Don> Contact the author, patch the library?

I tried the former - no answer yet. Maybe just waiting a little will
help.
As for the latter, it's just a binding to a C library.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Processing EXIF data with Haskell

2009-09-27 Thread Colin Paul Adams
I'm writing web software for a photograph gallery. I want to be able
to display selective fields from the EXIF data. I thought I would be
able to use the GD and exif libraries from Hackage to do
this. However:

Calling Graphics.GD.loadJpegByteString followed by
Graphics.GD.saveJpegFile does not preserve the EXIF fields of the
uploaded file, but instead writes some new ones (many fewer fields
than the original, and nothing of interest).

Graphics.Exif.allTags shows an interesting subset of the original EXIF
data, but nothing from the version saved by GD.

Can anyone shed any light on any of this?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] haskelldb + sqlite problem.

2009-09-05 Thread Colin Paul Adams
>>>>> "Colin" == Colin Paul Adams  writes:

>>>>> "Magicloud" == Magicloud Magiclouds  
>>>>> writes:
Magicloud> Hi, I am using haskelldb and
Magicloud> haskelldb-hdbc-sqlite3. Well, I finally got the source
Magicloud> compiled and ran, I got this error: App: user error
Magicloud> (SQL error: SqlError {seState = "", seNativeError = 21,
Magicloud> seErrorMsg = "prepare 74: SELECT subject,\n
Magicloud> timestamp\nFROM notes as T1\nORDER BY timestamp DESC:
Magicloud> library routine called out of sequence"}) Any clue what
Magicloud> I should check?

Colin> Did you get this working? If so, what was the problem and
Colin> how did you go about resolving it.

Colin> I have the identical problem. I had the database code
Colin> working fine, but then I added a state monad into the monad
Colin> stack for the program, and now I get this problem.  I see
Colin> that John Goerzen suggested it might be a result of reading
Colin> the data lazily.  So I tried changing my import statements
Colin> from import Control.Monad.State to import
Colin> Control.Monad.State.Strict

Colin> in case the StateT was indirectly causing the problem, but
Colin> that doesn't make any difference.

As I suspected, the problem is something to do with my putting the
Database.HaskellDB.Database.Database into the state monad, and getting
it from there, rather than passing it around explicitly. So I guess I
have too much laziness in:

ApplicationState db _ <- lift get

How do I force db in this situation?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] haskelldb + sqlite problem.

2009-09-04 Thread Colin Paul Adams

> "Magicloud" == Magicloud Magiclouds  
> writes:
Magicloud> Hi, I am using haskelldb and
Magicloud> haskelldb-hdbc-sqlite3. Well, I finally got the source
Magicloud> compiled and ran, I got this error: App: user error
Magicloud> (SQL error: SqlError {seState = "", seNativeError = 21,
Magicloud> seErrorMsg = "prepare 74: SELECT subject,\n
Magicloud> timestamp\nFROM notes as T1\nORDER BY timestamp DESC:
Magicloud> library routine called out of sequence"}) Any clue what
Magicloud> I should check?

Did you get this working? If so, what was the problem and how did you
go about resolving it.

I have the identical problem. I had the database code working fine,
but then I added a state monad into the monad stack for the program,
and now I get this problem.
I see that John Goerzen suggested it might be a result of reading the
data lazily.
So I tried changing my import statements from 
import Control.Monad.State
to
import Control.Monad.State.Strict

in case the StateT was indirectly causing the problem, but that
doesn't make any difference.

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


Re: [Haskell-cafe] happstack-helpers fails to install on Mac OSX

2009-08-31 Thread Colin Paul Adams
>>>>> "Colin" == Colin Paul Adams  writes:

>>>>> "Colin" == Colin Paul Adams  writes:
Colin> I've just installed the Haskell Platform (2009.2.0.2) on
Colin> Mac OSX 10.5.6, including GHC 6.10.4.

Colin> Then I started added some packahges with cabal install.

Colin> But happstack-helpers-0.30 fails with:

Colin> Happstack/Helpers/DirBrowse.hs:88:105 Couldn't match
Colin> expected type `String' against inferred type `Bool' In the
Colin> third argument of `hscolour', namely `False' In the second
Colin> argument of `(.)', namely `BrowseHtmlString . (hscolour
Colin> defaultColourPrefs False False f)'

Colin> Is this a known error, and if so, is there a workaround?

Colin> I guess it's the same problem that was reported earlier
Colin> this week with hlint and hscolour 1.15.  I'll try
Colin> installing an earlier version of hscolour. 

Yes. Installing hscolour 1.14 instead did the trick.

Can we have a new version of happstack-helpers that supports hscolour
1.15 please?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] happstack-helpers fails to install on Mac OSX

2009-08-30 Thread Colin Paul Adams
>>>>> "Colin" == Colin Paul Adams  writes:

Colin> I've just installed the Haskell Platform (2009.2.0.2) on
Colin> Mac OSX 10.5.6, including GHC 6.10.4.

Colin> Then I started added some packahges with cabal install.

Colin> But happstack-helpers-0.30 fails with:

Colin> Happstack/Helpers/DirBrowse.hs:88:105 Couldn't match
Colin> expected type `String' against inferred type `Bool' In the
Colin> third argument of `hscolour', namely `False' In the second
Colin> argument of `(.)', namely `BrowseHtmlString . (hscolour
Colin> defaultColourPrefs False False f)'

Colin> Is this a known error, and if so, is there a workaround?

I guess it's the same problem that was reported earlier this week with
hlint and hscolour 1.15.  I'll try installing an earlier version of hscolour.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] happstack-helpers fails to install on Mac OSX

2009-08-30 Thread Colin Paul Adams
I've just installed the Haskell Platform (2009.2.0.2) on Mac OSX
10.5.6, including GHC 6.10.4.

Then I started added some packahges with cabal install.

But happstack-helpers-0.30 fails with:

Happstack/Helpers/DirBrowse.hs:88:105
   Couldn't match expected type `String' against inferred type `Bool'
   In the third argument of `hscolour', namely `False'
   In the second argument of `(.)', namely
   `BrowseHtmlString . (hscolour defaultColourPrefs False False f)'

Is this a known error, and if so, is there a workaround?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem with monadic formlets

2009-08-30 Thread Colin Paul Adams

Chris> Hey everybody, I've just uploaded formlets 0.6.1 to
Chris> Hackage, which should fix this bug. Thanks for letting me
Chris> know!

Yes, it does fix it.

Thanks.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem with monadic formlets

2009-08-28 Thread Colin Paul Adams
>>>>> "Colin" == Colin Paul Adams  writes:

>>>>> "Jeremy" == Jeremy Shaw  writes:

Colin> apparent data corruprion is occurring. I am suspecting a
Colin> bug in the formlets library (I have version 0.6).

Colin> So I have created a slightly cut-down (no database
Colin> involved) complete working program. Can you see if this
Colin> works ok with your version of formlets:

I managed to uninstall formlets-0.6 myself, and then installed 0.5
instead. After adding the necessary extra argument to runFormletState
(an empty string), the test program works fine. So this seems to be a
bug in formlets-0.6.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Uninstall a cabal package?

2009-08-28 Thread Colin Paul Adams
> "Peter" == Peter Robinson  writes:

Peter> As far as I know the current stable release of Cabal
Peter> doesn't keep track of installed packages, so you can only #
Peter> ghc-pkg unregister pkg-id and then manually delete the
Peter> files.

Thanks. That works.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Uninstall a cabal package?

2009-08-28 Thread Colin Paul Adams
What is the procedure to uninstall a cabal package?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem with monadic formlets

2009-08-27 Thread Colin Paul Adams
> "Jeremy" == Jeremy Shaw  writes:

Jeremy> Hello, I hacked your code into a runnable example, and it
Jeremy> seems to work for me.

Jeremy> Which looks correct to me. Your code looks fine to me as
Jeremy> well... Perhaps the error is not in the code you pasted,
Jeremy> but somewhere else. I am running on an older, and somewhat
Jeremy> forked version of Formlets, so there could also be a bug
Jeremy> in the new code I guess. Though, that seems unlikely. But
Jeremy> it is worth noting that we are not using the same version
Jeremy> of the formlets library.

I did some debugging in ghci, but was unable to step through the
ensure and check routines, which is where the apparent data corruprion
is occurring. I am suspecting a bug in the formlets library (I have
version 0.6).

So I have created a slightly cut-down (no database involved) complete
working program. Can you see if this works ok with your version of
formlets:

module Main where

import Control.Applicative
import Control.Applicative.Error
import Control.Applicative.State
import Data.List as List
import Text.Formlets
import qualified Text.XHtml.Strict.Formlets as F
import qualified Text.XHtml.Strict as X
import Text.XHtml.Strict ((+++), (<<))
import Happstack.Server

type XForm a = F.XHtmlForm IO a

data Registration = Registration { regUser :: String
 , regPass :: String }
 deriving Show

handleRegistration :: ServerPartT IO Response
handleRegistration = withForm "register" register showErrorsInline (\u -> 
okHtml $ regUser u ++ " is successfully registered")

withForm :: String -> XForm a -> (X.Html -> [String] -> ServerPartT IO 
Response) -> (a -> ServerPartT IO Response) -> ServerPartT IO Response 
withForm name frm handleErrors handleOk = dir name $ msum
  [ methodSP GET $ createForm [] frm >>= okHtml
  , withDataFn lookPairs $ \d ->
  methodSP POST $ handleOk' $ simple d
  ]
  where
handleOk' d = do
  let (extractor, html, _) = runFormState d frm
  v <- liftIO extractor  
  case v of
Failure faults -> do 
  f <- createForm d frm
  handleErrors f faults
Success s  -> handleOk s
simple d = List.map (\(k,v) -> (k, Left v)) d
 
showErrorsInline :: X.Html -> [String] -> ServerPartT IO Response
showErrorsInline renderedForm errors =
  okHtml $ X.toHtml (show errors) +++ renderedForm
 
createForm :: Env -> XForm a -> ServerPartT IO X.Html
createForm env frm = do
  let (extractor, xml, endState) = runFormState env frm
  xml' <- liftIO xml
  return $ X.form X.! [X.method "POST"] << (xml' +++ X.submit "submit" "Submit")
 
okHtml :: (X.HTML a) => a -> ServerPartT IO Response
okHtml content = ok $ toResponse $ htmlPage $ content
 
htmlPage :: (X.HTML a) => a -> X.Html
htmlPage content = (X.header << (X.thetitle << "Testing forms"))
  +++ (X.body << content)

register :: XForm Registration
register = Registration <$> user <*> passConfirmed

user :: XForm String
user = pure_user `F.checkM` F.ensureM valid error where
valid name = return True
error = "Username already exists in the database!"
 
pure_user :: XForm String
pure_user = input `F.check` F.ensure valid error where
input = "Username" `label` F.input Nothing
valid = (>= 3) . length
error = "Username must be three characters or longer."

passConfirmed :: XForm String
passConfirmed = fst <$> passwords `F.check` F.ensure equal error where
passwords = (,) <$> pass "Password" <*> pass "Password (confirm)"
equal (a, b) = a == b
error = "The entered passwords do not match!"

pass :: String -> XForm String
pass caption = input `F.check` F.ensure valid error where
input = caption `label` F.password Nothing
valid = (>=6) . length
error = "Password must be six characters or longer."

label :: String -> XForm String -> XForm String
label l = F.plug (\xhtml -> X.p << (X.label << (l ++ ": ") +++ xhtml))

main = simpleHTTP (nullConf {port = 9959}) handleRegistration

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


[Haskell-cafe] Problem with monadic formlets

2009-08-27 Thread Colin Paul Adams
I'm trying to validate user input against a database (using HaskellDB,
but that doesn't seem to be the problem, as replacing the database
monadic code with return True gives the same problem.

This is part of my code:

register :: Database -> XForm Registration
--register db = Registration <$> pure_user <*> passConfirmed
register db = Registration <$> (user db) <*> passConfirmed

user :: Database -> XForm String
user db = pure_user `F.checkM` F.ensureM valid error where
valid name = do
  let q = do
t <- table user_table
restrict (t!user_name .==. constant name)
return t
  rs <- query db q
  return $ null rs
error = "Username already exists in the database!"
 
pure_user :: XForm String
pure_user = input `F.check` F.ensure valid error where
input = "Username" `label` F.input Nothing
valid = (>= 3) . length
error = "Username must be three characters or longer."

passConfirmed :: XForm String
passConfirmed = fst <$> passwords `F.check` F.ensure equal error where
passwords = (,) <$> pass "Password" <*> pass "Password (confirm)"
equal (a, b) = a == b
error = "The entered passwords do not match!"

pass :: String -> XForm String
pass caption = input `F.check` F.ensure valid error where
input = caption `label` F.password Nothing
valid = (>=6) . length
error = "Password must be six characters or longer."

If I uncomment the commented line, and comment out the line after it
(in register), then everything works as expected. However, using it as
it is, one of the calls to pass gets the user's name for validation
(and consequently either fails if the user name is only 5 characters,
or the comparison of the two passwords fail (unless I type the user
name as the password).

I thought the applicative style meant the effects did not influence
one another, but here there is clear contamination. What am i doing wrong?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Qualified operators

2009-08-27 Thread Colin Paul Adams
> "Miguel" == Miguel Mitrofanov  writes:

Miguel> firstArgument Cool.Module.Name.%-& secondArgument

Thanks.

I think I tried that first, must have have got misled by ghc's other
confusing messages.

Compiling ok now.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Qualified operators

2009-08-27 Thread Colin Paul Adams
What's the syntax for using a qualified operator (I have a clash of !)?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Where does documentation get installed with cabal?

2009-08-21 Thread Colin Paul Adams
> "Antoine" == Antoine Latter  writes:

Antoine> On Thu, Aug 20, 2009 at 8:58 AM, Colin Paul
Antoine> Adams wrote:
>> Hello,
>> 
>> I'm trying to find the API documentation for happstack 0.3
>> (online is for 0.2).
>> 
>> So I did:
>> 
>> cabal install happstack --reinstall --enable-documentation
>> 
>> but I can't find it anywhere within ~/.cabal - where should I
>> look?

Antoine> Most of hasppstack functionality is not in the
Antoine> "happstack" package, it's in the happstack-* packages. So
Antoine> installing the happstack package with documentation won't
Antoine> really pull in much documentation at all.

Thanks. That was what I was missing.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Where does documentation get installed with cabal?

2009-08-20 Thread Colin Paul Adams
>>>>> "Max" == Max Desyatov  writes:

Max> Colin Paul Adams  writes:
>> I'm trying to find the API documentation for happstack 0.3
>> (online is for 0.2).
>> 
>> So I did:
>> 
>> cabal install happstack --reinstall --enable-documentation
>> 
>> but I can't find it anywhere within ~/.cabal - where should I
>> look?

Max> In most cases it is installed in
Max> ~/.cabal/share/doc/happstack*/html.  Is there any files at
Max> that directory?

There are now, but only a very few. And very little contents in them.
It's as if the --reinstall were partial.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Where does documentation get installed with cabal?

2009-08-20 Thread Colin Paul Adams
Hello,

I'm trying to find the API documentation for happstack 0.3 (online is
for 0.2).

So I did:

cabal install happstack --reinstall --enable-documentation

but I can't find it anywhere within ~/.cabal - where should I look?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] gbp sign showing as unknown character by GHC

2009-08-20 Thread Colin Paul Adams
> "Stuart" == Stuart Cook  writes:

Stuart> On Thu, Aug 20, 2009 at 4:28 PM, Colin Paul
Stuart> Adams wrote:
>> But how do you get Latin-1 bytes from a Unicode string? This
>> would need a transcoding process.

Stuart> The first 256 code-points of Unicode coincide with
Stuart> Latin-1. Therefore, if you truncate Unicode characters
Stuart> down to 8 bits you'll effectively end up with Latin-1 text
Stuart> (except that any code points above U+00FF will give
Stuart> strange results).

Stuart> If your terminal then interprets these bytes as UTF-8 (or
Stuart> anything else, really), the result will be gibberish or
Stuart> worse.

Yes, but surely this will work both ways. The same bytes on input
should come back on output, shouldn't they?

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


Re: [Haskell-cafe] gbp sign showing as unknown character by GHC

2009-08-19 Thread Colin Paul Adams
> "Bulat" == Bulat Ziganshin  writes:

Bulat> Hello Colin,
Bulat> Thursday, August 20, 2009, 10:13:28 AM, you wrote:

> I don't understand where latin-1 comes into this. String is supposed
>> to be a list of Unicode characters.

Bulat> but ghc 6.10 i/o used String as list of bytes

But how do you get Latin-1 bytes from a Unicode string? This would
need a transcoding process.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] gbp sign showing as unknown character by GHC

2009-08-19 Thread Colin Paul Adams
> "Judah" == Judah Jacobson  writes:

Judah> On Wed, Aug 19, 2009 at 10:31 AM, Iain Barnett 
wrote:
>> Quick question: I've tested this in a couple of different
>> terminals (roxterm and xterm), so I'm fairly sure it's GHC
>> that's the problem. Have I missed a setting?  GHCi, version
>> 6.10.4
Prelude> putStrLn "£"
>> � Hugs98 200609-3
Hugs> putStrLn "£"
>> £
>> 

ghc-6.10.4 and earlier don't automatically encode/decode Unicode
Judah> characters.  So on terminals which don't use the latin-1
Judah> encoding, you need to do the conversion explicitly with a
Judah> separate package such as utf8-string, iconv or text-icu.

I don't understand where latin-1 comes into this. String is supposed
to be a list of Unicode characters.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANN: Typeful/Text/HTMLs (for AngloHaskell/for scrap?)

2009-08-19 Thread Colin Paul Adams
> "Jon" == Jon Fairbairn  writes:

>> Will it be cabal-ized soon?

Jon> That depends on whether anyone wants it done sufficiently
Jon> strongly to do it.

Then I guess I will - some time in October.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANN: Typeful/Text/HTMLs (for AngloHaskell/for scrap?)

2009-08-19 Thread Colin Paul Adams
> "Jon" == Jon Fairbairn  writes:

Jon> I wrote:
>> You can get the whole thing with
>> 
>> darcs get --partial
>> http://homepage.ntlworld.com/jon.fairbairn/Typeful/Text/nHTMLs

Jon> but that was a temporary url that I copied and pasted. The
Jon> correct one:

Jon> darcs get --partial
Jon> http://homepage.ntlworld.com/jon.fairbairn/Typeful/Text/HTMLs

Did you make any progress on this at Anglo-Haskell? Will it be
cabal-ized soon?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Planning for a website

2009-08-19 Thread Colin Paul Adams
>>>>> "Gour" == Gour   writes:

>>>>> "Colin" == Colin Paul Adams  writes:
Colin> So my major decision is what framework and html-generating
Colin> libraries to use. There is such a wide choice on the
Colin> Haskell Wiki. But I guess some are more maintained than
Colin> others. For instance, WASH attracts me, with it's guarantee
Colin> of valid generated pages, but it isn't clear to me that
Colin> it's actively maintained (last date I can see on the web
Colin> pages is 2006).

Gour> Have you thought about Turbinado (http://turbinado.org) ?


I didn't like it when I clicked on the link that says:

Learn about Turbinado here

and got a this page doesn't exist response.

Then I looked at the archticeture link, and didn't like the idea of
having to generate Haskell data types from relational tables (if i
understood it right).

I'd much rather be using happstack's macid stuff, especially as I will
have only very low usage, so i shouldn't have any scalability problems.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Planning for a website

2009-08-18 Thread Colin Paul Adams
>>>>> "Jake" == Jake McArthur  writes:

    Jake> Colin Paul Adams wrote:
>> One problem will be to get GHC ported to DragonFly BSD, but
>> that can wait until I have a test version of the site working
>> on Linux.

Jake> I would love to see this. It's the biggest thing blocking me
Jake> from trying Dragonfly more seriously.

Well it will happen, as I have to use DragonFly, as my website is all
about dragonflies :-)

Someone has already got it working sufficiently to compile xmonad, so
it should just be a matter of digging around the low-level issues.

Jake> You should look into HSP. It also provides those guarantees,
Jake> is maintained, and provides a nice template-style syntax
Jake> which you can use inline with your Haskell code.

Jake> Also check out the Formlets library.

>> HappStack is obviously currently maintained, and since it seems
>> to have a blogging module in development, that is attractive.

Jake> I recommend this.

Thanks.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Planning for a website

2009-08-18 Thread Colin Paul Adams
I'm intending to replace my current website - which uses Drupal, with
a hand-written-in-Haskell version this autumn, for a number of reasons
(a principal one is the lack of an upgrade path in Drupal). So I'm
currently looking into the libraries available to see how much I'll
have to write myself.

One problem will be to get GHC ported to DragonFly BSD, but that can
wait until I have a test version of the site working on Linux.

The next major challange is to implement something like Drupal's Image
and Image Gallery modules. That doesn't seem to be a great problem, as
the exif and GD libraries seem to cover everything I'll need.

So my major decision is what framework and html-generating libraries
to use. There is such a wide choice on the Haskell Wiki. But I guess
some are more maintained than others. For instance, WASH attracts me,
with it's guarantee of valid generated pages,
but it isn't clear to me that it's actively maintained (last date I
can see on the web pages is 2006).

HappStack is obviously currently maintained, and since it seems to
have a blogging module in development, that is attractive.
HASP is maintained too, I think.

Has anyone written a comparison of the various libraries, or gone
through the same decision process recently?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Text.Html introduction

2009-08-18 Thread Colin Paul Adams
http://www.haskell.org/ghc/docs/latest/html/libraries/xhtml/Text-XHtml.html
says:

"Based on the original Text.Html library by Andy Gill. See
http://www.cse.ogi.edu/~andy/html/intro.htm for an introduction to
that library. "

But that link gives a not-found page.

Anyone know where it is know?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Can't install Haskell Platform on 64-bit Linux

2009-08-18 Thread Colin Paul Adams
> "Magnus" == Magnus Therning  writes:

Magnus> Ouch, there only seems to be a version of 6.10.3 in Fedora
Magnus> 11, if I read this correctly:
Magnus> https://admin.fedoraproject.org/pkgdb/packages/name/ghc
Magnus> (I'm not a Fedora user so I might be completely confused
Magnus> here :-)

Magnus> It looks like the pre-built ghc can't find the installed
Magnus> libgmp.

I don't think it's a problem with libgmp. I think that's just a
cautionary message, based on experience that this is a common error.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Can't install Haskell Platform on 64-bit Linux

2009-08-18 Thread Colin Paul Adams
> "Magnus" == Magnus Therning  writes:

Magnus> On Tue, Aug 18, 2009 at 10:25 AM, Colin Paul
Magnus> Adams wrote:
>> I installed GHC 6.10.4 (as ./configure said it was required)
>> from a .bz2 file on the GHC downloads page. I then tried
>> ./configure for the platform again, and got:

Magnus> What distribution of Linux do you use?

Fedora.

Magnus> I'd strongly suggest getting it from your distro's repo
Magnus> rather than downloading the tar-ball.  That way you avoid
Magnus> satisfying dependencies manually.

It's not available.

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


[Haskell-cafe] Can't install Haskell Platform on 64-bit Linux

2009-08-18 Thread Colin Paul Adams
I installed GHC 6.10.4 (as ./configure said it was required) from a
.bz2 file on the GHC downloads page. I then tried ./configure for the
platform again, and got:

checking ghc actually works... no
configure: error: Your installation of ghc does not appear to work.
  It cannot compile a simple program (see config.log for the details).
  If you installed ghc from a generic binary tarball then it is worth
  checking that you have the 'gmp' C library and header files installed.
  (On debian-based systems this package is called libgmp3-dev.)

Looking in config.log, I see:

configure:2287: checking ghc actually works
configure:2296: /usr/local/bin/ghc -o conftest conftest.hs
/tmp/ghc22651_0/ghc22651_0.s: Assembler messages:

/tmp/ghc22651_0/ghc22651_0.s:43:0:
 Error: suffix or operands invalid for `push'

/tmp/ghc22651_0/ghc22651_0.s:89:0:
 Error: suffix or operands invalid for `push'

/tmp/ghc22651_0/ghc22651_0.s:135:0:
 Error: suffix or operands invalid for `push'
configure:2299: $? = 1
configure: failed program was:
main = putStr "Hello world!\n"
-- this file generated by TRY-COMPILE-GHC
end of failed program.
configure:2308: result: no
configure:2314: error: Your installation of ghc does not appear to work.
  It cannot compile a simple program (see config.log for the details).
  If you installed ghc from a generic binary tarball then it is worth
  checking that you have the 'gmp' C library and header files installed.
  (On debian-based systems this package is called libgmp3-dev.)

Libgmp is installed.

I don't know the significance of the assembler error messages. If I
type from the command line:

ghci

I get the Prelude> prompt, so it looks like the installation is OK at
first glance.

What should I check next?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Thinking about what's missing in our library coverage

2009-08-05 Thread Colin Paul Adams
> "Tom" == Tom Tobin  writes:

>> This can surely be tackled by cabal, as it already has the
>> license information.

Tom> I don't see this as a real solution; why would a package be

It should be done anyway, irrespective of the platform.

Tom> added to the platform in the first place if a large
Tom> proportion of developers couldn't make use of it?

Anyone can make use of it. You may choose not to (or your boss may
choose for you), but that doesn't mean you can't.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Thinking about what's missing in our library coverage

2009-08-05 Thread Colin Paul Adams
> "Tom" == Tom Tobin  writes:


Tom> As I understand it, Pandoc is entirely under the GPL (not
Tom> LGPL).  I'd be very wary of accepting a GPL'd library as a

I'd be very upset if pandoc weren't blessed.

Tom> blessed "standard" library, since it would be completely
Tom> unusable for non-GPL projects.

This can surely be tackled by cabal, as it already has the license
information.

So if you were to specify you project has a BSD license, and it
requires use of a library licensed under the GPL, then cabal configure
should fail with an error message.

Just because a library is blessed, doesn't mean you have to use it.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Proposal: TypeDirectedNameResolution

2009-07-28 Thread Colin Paul Adams
> "Ryan" == Ryan Ingram  writes:

Ryan> Along those lines, what about being able to elide class
Ryan> names when they can be unambiguously determined from the
Ryan> functions defined?

Ryan> instance _ [] where fmap = map pure x = [x] fs <*> xs = [ f
Ryan> x | f <- fs, x <- xs ] return x = [x] m >>= f = concatMap f
Ryan> m

Ryan> This would define Functor, Applicative, and Monad for [].

What happens if I define a class Foo with a method named fmap? If this
were in scope then Functor would no longer be defined for [].

Could this situation cause a problem?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-21 Thread Colin Paul Adams
> "Judah" == Judah Jacobson  writes:

Judah> On Sun, Jun 21, 2009 at 11:12 PM, Colin Paul
Judah> Adams wrote:
>> I've been hoogling like bad to try to determine if a function
>> like this exists.
>> 
>> getDirectoryContents returns sub-directories as well as file
>> names. I want only the latter, so I'm looking for a suitable
>> filter.

Judah> Use System.Directory.doesDirectoryExist/doesFileExist.

Thanks.

it seems it's time i went to the optician again.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-21 Thread Colin Paul Adams
I've been hoogling like bad to try to determine if a function like
this exists.

getDirectoryContents returns sub-directories as well as file names. I
want only the latter, so I'm looking for a suitable filter.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2009-06-06 Thread Colin Paul Adams
I tried a cabal install chp: It complained that base was hidden.

So I unpacked the archive, and tried installing using runhaskell
Setup configure/build/install. Now I get (from install):

Setup: You need to re-run the 'configure' command. The version of Cabal being
used has changed (was Cabal-1.6.0.3, now Cabal-1.6.0.2).

So I repeated the process and get the same message again.

ghc version is 6.10.3

Also:
cabal --version
cabal-install version 0.6.2
using version 1.6.0.2 of the Cabal library 

Where does this 1-6.0.3 come from (Ghc HEAD perhaps?)? What can I do
about it? 
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Can't install happs-tutorial because syb-with-class fails to install

2009-05-17 Thread Colin Paul Adams
False alarm. It compiles OK with ghc 6.10.3.
The failure was with ghc 6.11.20090404.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Can't install happs-tutorial because syb-with-class fails to install

2009-05-17 Thread Colin Paul Adams
Data/Generics/SYB/WithClass/Derive.hs:187:26:
Couldn't match expected type `Pred' against inferred type `Type'
  Expected type: PredQ
  Inferred type: TypeQ
In the first argument of `map', namely `dataCxt'
In the first argument of `(++)', namely `map dataCxt dataCxtTypes'

Data/Generics/SYB/WithClass/Derive.hs:198:36:
Couldn't match expected type `Pred' against inferred type `Type'
  Expected type: Q Pred
  Inferred type: TypeQ
In the expression: conT 'Data `appT` typ
In the first argument of `map', namely
`(\ typ -> conT 'Data `appT` typ)'

Data/Generics/SYB/WithClass/Derive.hs:227:38:
Couldn't match expected type `Name'
   against inferred type `TyVarBndr'
  Expected type: [Name]
  Inferred type: [TyVarBndr]
In the expression: ps
In the first argument of `return', namely `(n, ps, map conA cs)'
cabal: Error: some packages failed to install:
syb-with-class-0.5.1 failed during the building phase. The exception was:
exit: ExitFailure 1

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


Re: [Haskell-cafe] List of exports of a module - are there alternatives?

2009-05-12 Thread Colin Paul Adams
> "Andrew" == Andrew Wagner  writes:

Andrew> Uh, show me such a module, and I'll show you a module
Andrew> that's quite bloated and desperately needs to be
Andrew> refactored.

How about a module that provides the official Unicode names for each character?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-23 Thread Colin Paul Adams
> "Lennart" == Lennart Augustsson  writes:

Lennart> Of course, n+k will be missed by Haskell obfuscators.  I
Lennart> mean, what will we do without (+) + 1 + 1 = (+) ?

I think what would be missed would you be having the opportunity to
explain to me what it means.

But as we still have them, go right ahead (please).
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Link errors in Gtk2Hs are more general than I thought.

2009-04-04 Thread Colin Paul Adams
> "Jeff" == Jeff Wheeler  writes:

Jeff> I installed Gtk2Hs on a similar machine earlier tonight,
Jeff> with much success, even with Yi.

Jeff> I did not use MacPorts, and instead followed the
Jeff> instructions on the HaskellWiki [1] under "Using the GTK+ OS
Jeff> X Framework" (including compiling pkg-config from src). I'm
Jeff> not sure how having attempted the installation through
Jeff> MacPorts may have littered your system, unfortunately.

A lot I think (I tried the Framework install once, and spent a LOT of
time cleaning up, and the same when I reverted  macports).

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


Re: [Haskell-cafe] Re: Completely confused by cabal

2009-03-22 Thread Colin Paul Adams
>>>>> "Duncan" == Duncan Coutts  writes:

Duncan> On Sun, 2009-03-22 at 11:51 +, Colin Paul Adams wrote:
>> >>>>> "Achim" == Achim Schneider  writes:
>> 
Achim> Colin Paul Adams  wrote:
> >> So why doesn't it find packages then, when they are installed?
>> >> 
Achim> I've got no idea, what exactly are you trying to do, and
Achim> how?
>> 
>> I'm trying to re-compile ghc 6.11 and it doesn't find parsec.

Duncan> The ghc build system is fairly self contained. I'm not
Duncan> sure if it cares if your bootstrapping compiler has parsec
Duncan> or not. If the ghc build system is looking for the parsec
Duncan> modules then I very much doubt it is going to be looking
Duncan> in any parsec package that your bootstrapping compiler
Duncan> might have registered (either globally or per-user). It'll
Duncan> be looking for the sources that it comes bundled with.

Duncan> A quick look in my ghc source tree reveals:

Duncan> ghc/utils/ext-core/Language/Core/ParsecParser.hs
Duncan> ghc/libraries/parsec/Text/ParserCombinators/Parsec.hs

Duncan> The first one, utils/ext-core is importing parsec. Is that
Duncan> what you're trying to build? The parsec package is an

No. 
I assumed that would be built anyway.

Duncan> extralib so wouldn't be present unless you did ./darcs-all
Duncan> --extra get

Duncan> If you can't get the ghc build going try asking on the ghc
Duncan> users mailing list. Give as much detail as you can about
Duncan> what you did so people can give you more helpful advice.

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


Re: [Haskell-cafe] Re: Completely confused by cabal

2009-03-22 Thread Colin Paul Adams
>>>>> "Andrea" == Andrea Vezzosi  writes:

Andrea> On Sun, Mar 22, 2009 at 12:51 PM, Colin Paul Adams
Andrea>  wrote:
>>>>>>> "Achim" == Achim Schneider  writes:
>> 
>>    Achim> Colin Paul Adams  wrote:
>>    >> So why doesn't it find packages then, when they are
>> installed?     >>    Achim> I've got no idea, what exactly are
>> you trying to do, and    Achim> how?
>> 
>> I'm trying to re-compile ghc 6.11 and it doesn't find parsec.

Andrea> when cabal is invoked by root, like in su -c "cabal ..."
Andrea> or su -c "runghc Setup ...", it won't see the user
Andrea> packagedb, but there's rarely a reason to do so.  Usually
Andrea> only the install phase needs to be done as root, while
Andrea> building and configuring can be done as user.  For ghc
Andrea> you'd want to run ./configure and make as user and make
Andrea> install as root.  For normal packages, if you want to
Andrea> install them system wide, you'd use something like cabal
Andrea> install --global --root-cmd=sudo foo

OK. I did:

cabal install parsec --global --root-cmd=sudo

and now when I try to make ghc I get:

verify/SimplIface.lhs:16:7:
Could not find module `Text.ParserCombinators.Parsec.Language':
  it is a member of the hidden package `parsec-2.1.0.1'
  Use -v to see a list of the files searched for.

so I've managed to get parsec installed.

Now I think I have to add it to a .cabal file somewhere.

verify is a directory I added as a sub-directory of compiler, so i
tried adding the following line to compiler/ghc.cabal:

   Build-Depends: parsec >= 2 && < 3

but it made no difference.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Completely confused by cabal

2009-03-22 Thread Colin Paul Adams
>>>>> "Achim" == Achim Schneider  writes:

    Achim> Colin Paul Adams  wrote:
>> So why doesn't it find packages then, when they are installed?
>> 
Achim> I've got no idea, what exactly are you trying to do, and
Achim> how?

I'm trying to re-compile ghc 6.11 and it doesn't find parsec.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Completely confused by cabal

2009-03-22 Thread Colin Paul Adams
So why doesn't it find packages then, when they are installed?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


  1   2   >