Re: ANNOUNCE: hmake-3.06
hmake-3.06 -- We are pleased to announce a fresh, bugfix, release of hmake, the Haskell compilation manager. www.cs.york.ac.uk seems to be down. Does anyone know of a mirror that might have the new release, or when the home site will be back up? Murphy's law in action: mere minutes after I announced the availability of hmake, our web/ftp server had a catastrophic disc failure which is still awaiting repair. Here is the new location of hmake's documentation and downloads: http://www.haskell.org/hmake Regards, Malcolm ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Yet more text pedantry
fre 2002-08-09 klockan 21.46 skrev Alastair Reid: Can we stop the pedantry and have some people go off in a corner and produce a design which [...] I think this has gone on long enough on the Haskell mailing list, and if I wasn't interested I would probably have dropped of long ago. Looking at my original post (UTF-8 library), I never expected this much traffic :) Can't we make a mailing list for these issues? [EMAIL PROTECTED] is my proposal, who can create such a list? I'm interested in participating in a working group to solve these issues. Regards, Martin -- Martin Norbäck [EMAIL PROTECTED] Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG http://www.dtek.chalmers.se/~d95mback/ SWEDEN OpenPGP ID: 3FA8580B signature.asc Description: PGP signature
ANNOUNCE: HaXml-1.06
HaXml-1.06 -- http://www.haskell.org/HaXml/ We are pleased to announce a fresh release of HaXml, the collection of libraries and tools for using XML from Haskell. HaXml includes * a parser for XML; * a separate error-correcting parser for HTML; * an XML validator; * pretty-printers for XML and HTML; * a combinator library for generic XML document transformation, editing, and generation; * class Haskell2Xml which allows you to read and write ordinary Haskell data as XML; * DtdToHaskell, a tool for translating an XML DTD into equivalent Haskell types; * Xtract, a grep-like tool for XML documents. Release 1.06 is a major re-packaging of these facilities. Highlights include: * HaXml now uses the new hierarchical namespace for modules, specifically under the tree Text.Xml.HaXml. * The HaXml libraries now install as a separate `package' in both ghc and nhc98. Use -package HaXml to access them. * The library APIs are now documented using Haddock. * Due to popular request, we have added a new validator for checking generic document content against a DTD. This is available both as a library function, and as a command-line tool. * DrIFT is now distributed separately by John Meacham, with much better configuration and build support. You still only need it if you want to derive the Haskell2Xml class. * Bugfix: the lexer and parser now accept NOTATION declarations in the DTD. * Bugfix: a PublicId in a NOTATION decl is now correctly recognised by the keyword PUBLIC, not PUBLICID. * Bugfix: the HTML parser now correctly accepts stand-alone tags like IMG. * Bugfix: instances of XmlContent now accept an empty string where #PCDATA is expected. Likewise, comments, processing instructions, and character/entity references are now permitted to be scattered thoughout some #PCDATA text. * Bugfix: the OneOfN types used in code generated by DtdToHaskell are now supplied by default up to size 20, and a utility for automatically generating larger sizes is included. Regards, Malcolm ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Newbie question on statefullness
At 2002-08-11 17:36, Alex Peake wrote: I want to implement something like the C idea of: n += i So how does one doe this in Haskell? do { val - readIORef n; writeIORef n (val + i); }; -- Ashley Yakeley, Seattle WA ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Modification of State Transformer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sunday 11 August 2002 07:26 pm, Scott J. wrote: Hi, I invite you then to explain what happens with every step. The use of forall is misleading and fast to be misunderstood: I mention here the inner forall's. Thx Scott This list is great. The implementation in the ST module solves the problem and I understand how it works. Shawn Given the level of detailed explanations to date, I don't see the point. But I'll go ahead and do so anyway, by summarizing what I've learned from the previous posts. I had read the example in Bird'd book on state transformers. The definition of state however was a fixed type in the examples. Wanting to extend the definition and make it more general I was trying to figure out how to modify the type. Bird's definition was: newtype St a = MkSt (State - (a,State)) type State = type I had attempted to extend the type as follows newtype St a s = MkSt (s - (a,s)) This died in the compiler when declaring this type as an instance of Monad: instance Monad St where return x = MkSt f where f s = (x,s) p = q = MkSt f where f s = apply(q x) s' where (x,s') = apply p s ghc returned the following (referencing the instance line): Couldn't match `*' against `* - *' Expected kind: (* - *) - * Inferred kind: (* - * - *) - * When checking kinds in `Monad St' In the instance declaration for `Monad St' When a type constructor has an argument it has a type of `* - *'. When a type constructor has two arguments it has a type of `* - * - *'. This construction of the type can be extended to n arguments by having the number of `-' match the n arguments of type and the `*' be n+1. The class definition of Monad contains the following: class Monad m where return :: a - m a (=) :: m a - (a - m b) - m b So the class of St a s needs reduction from `* - * - *' to `* - *' to fit the single argument type constructor of the Monad class. By using (St a) which causes the type constructor to be of type `(* - *) - *'. Since `(* - *)' can be used as `*', by creation of another type. This because equivalent to `* - *'. The only thing left is reversing the order so that the result type is of the correct form in the Monad usage. I.e, in my initial ordering the `return' of the Monad would end up returning something of type `s' which is not particularly useful, since type `a' is the desired return type from the transformer. So the corrected version of State becomes: newtype St s a = MkSt (s - (a, s)) instance Monad (St s) where ... Shawn Garbett - -- You're in a maze of twisty little statements, all alike. Public Key available from http://www.garbett.org/public-key -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9V8P4DtpPjAQxZ6ARAq0VAJ9toEiEm+d58vgbKEofzXBISyXrEACfasbc eaEg2zVi9y90vk+fXKGSrt0= =OrwN -END PGP SIGNATURE- ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Fw: Modification of State Transformer
- Original Message - From: Scott J. [EMAIL PROTECTED] To: Shawn P. Garbett [EMAIL PROTECTED] Sent: Monday, August 12, 2002 9:04 PM Subject: Re: Modification of State Transformer I 'm sorry, What I meant was discussion about the state transformer ST s a itself. And how it works. What does mean the second inner forall loop and so on. I can't find explanations of this in the Haskell library. Regards Scott - Original Message - From: Shawn P. Garbett [EMAIL PROTECTED] To: Scott J. [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, August 12, 2002 4:19 PM Subject: Re: Modification of State Transformer -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sunday 11 August 2002 07:26 pm, Scott J. wrote: Hi, I invite you then to explain what happens with every step. The use of forall is misleading and fast to be misunderstood: I mention here the inner forall's. Thx Scott This list is great. The implementation in the ST module solves the problem and I understand how it works. Shawn Given the level of detailed explanations to date, I don't see the point. But I'll go ahead and do so anyway, by summarizing what I've learned from the previous posts. I had read the example in Bird'd book on state transformers. The definition of state however was a fixed type in the examples. Wanting to extend the definition and make it more general I was trying to figure out how to modify the type. Bird's definition was: newtype St a = MkSt (State - (a,State)) type State = type I had attempted to extend the type as follows newtype St a s = MkSt (s - (a,s)) This died in the compiler when declaring this type as an instance of Monad: instance Monad St where return x = MkSt f where f s = (x,s) p = q = MkSt f where f s = apply(q x) s' where (x,s') = apply p s ghc returned the following (referencing the instance line): Couldn't match `*' against `* - *' Expected kind: (* - *) - * Inferred kind: (* - * - *) - * When checking kinds in `Monad St' In the instance declaration for `Monad St' When a type constructor has an argument it has a type of `* - *'. When a type constructor has two arguments it has a type of `* - * - *'. This construction of the type can be extended to n arguments by having the number of `-' match the n arguments of type and the `*' be n+1. The class definition of Monad contains the following: class Monad m where return :: a - m a (=) :: m a - (a - m b) - m b So the class of St a s needs reduction from `* - * - *' to `* - *' to fit the single argument type constructor of the Monad class. By using (St a) which causes the type constructor to be of type `(* - *) - *'. Since `(* - *)' can be used as `*', by creation of another type. This because equivalent to `* - *'. The only thing left is reversing the order so that the result type is of the correct form in the Monad usage. I.e, in my initial ordering the `return' of the Monad would end up returning something of type `s' which is not particularly useful, since type `a' is the desired return type from the transformer. So the corrected version of State becomes: newtype St s a = MkSt (s - (a, s)) instance Monad (St s) where ... Shawn Garbett - -- You're in a maze of twisty little statements, all alike. Public Key available from http://www.garbett.org/public-key -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9V8P4DtpPjAQxZ6ARAq0VAJ9toEiEm+d58vgbKEofzXBISyXrEACfasbc eaEg2zVi9y90vk+fXKGSrt0= =OrwN -END PGP SIGNATURE- ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Fw: Modification of State Transformer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Monday 12 August 2002 02:08 pm, Scott J. wrote: - Original Message - From: Scott J. [EMAIL PROTECTED] What I meant was discussion about the state transformer ST s a itself. And how it works. What does mean the second inner forall loop and so on. I can't find explanations of this in the Haskell library. Oh! If you look in the paper that's mentioned: _Lazy_Functional_State_Threads_, by John Launchbury and Simon Jones, 1994, there's a big section on this. To quote: Section 2.4 Encapsulaion So far we have been able to combine state transformers to make larger state transformers, but how can we make a state transformer part of a larger program which does not manipulate state at all? What we need is a function, runST, with a type something like the following: runST :: ST s a - a The idea is that runST takes a state transformer as its argument, conjures up an initial empty state, applies the state transformer to it, and returns the result while discarding the final state. ... Discussion of usage implications, and how this initial guess at type creates all kinds of potential usage problems ... To put it another way, the argument of runST should no make any assumptions about what has already been allocated in the initial state, That is, runST should work regardless of what initial state it is given. So the type of runST should be: runST :: forall a . (forall s.ST s a) - a This is not a Hindley-Milner type, because the quantifiers are not all at the top level; it is an example of rank-2 polymorphism (McCracken [1984]). Section 5.2 Types Most of the type rules are the usual Hindley-Milner rules. The most interesting addition is the typing judgement for runST. Treating it as a language construct avoids the need to go beyond Hindley-Milner types. So rather than actually give runST the type runST :: forall a . (forall s.ST s a) - a as suggested in the introduction, we ensure that its typing judgment has the same effect. - -- You're in a maze of twisty little statements, all alike. Public Key available from http://www.garbett.org/public-key -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9WAthDtpPjAQxZ6ARAgsqAJ9i+oIdWHvQB80xmEhugQTklOtpvQCdFbM5 ol6XOKjp7FGdM3oetPUTw+E= =+exg -END PGP SIGNATURE- ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Newbie question on statefullness
This has been coming up a lot, probably because of Paul Graham's challenge: http://www.paulgraham.com/accgen.html So the answer is probably: it has to be done this way because that's what the challenge specifies. Paul's language of choice is Lisp, and he combines a higher-order function with a side-effect to give a very short and simple solution. In a side-effect free language the answer will tend to be more cumbersome, because you have to jump through some hoops to manage the state. This is certainly not a great introductory problem for someone trying to learn a _pure_ functional language. OTOH, if you want to do anything useful with any language you have to learn to do IO (and simple IO is tackled early in most languages), and therefore you must deal with Monads. I often wish that Haskell books and tutorials would introduce IO earlier; it is often near the end, in the advanced topics (after you've been dazzled/saturated by the magic you can do with list functions and comprehensions, and how easy it is to create abstract datatypes, and write parsers, etc...). Alistair Original Message: From: Andrew J Bromage Sent: Monday 12 Aug 2002 02:27 Subject: Re: Newbie question on statefullness G'day all. On Sun, Aug 11, 2002 at 05:36:21PM -0700, Alex Peake wrote: I am new to Haskell. I want to do something very simple (I thought) but got lost in the world of Monads. I want to implement something like the C idea of: n += i So how does one doe this in Haskell? I think this needs to be an FAQ. The short answer is that if you find yourself needing to do this, especially if you're new to Haskell, you're probably thinking about the problem in the wrong way. Haskell does not support the n += i idiom in the same way that C does not support, say, higher-order functions. The flip side is that Haskell _does_ support the n += i idiom in the same way that C _does_ support higher-order functions, in that with some effort (sometimes a little, sometimes a lot) you can simulate the same functionality if you find you really need it (using monads, continuations or whatever). However, most of the time where you would use this idiom in C, you would not use it in the equivalent Haskell program, simply because there's usually a more appropriate way of phrasing your intentions. Cheers, Andrew Bromage ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe