Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Roman Beslik
On 25.06.10 20:09, Jason Dagit wrote: you got everything right here. So, as you said, there is a mismatch between representation in Haskell (list of code points) and representation in the operating system (list of bytes), so we need to know the encoding. Encoding is supplied

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Andrew Coppin
wren ng thornton wrote: And, as Jason said, if you're just interested in having the same programming style at both term and type levels, then you should look into dependently typed languages. Out of curiosity, what the hell does dependently typed mean anyway?

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Stephen Tetley
On 26 June 2010 08:07, Andrew Coppin andrewcop...@btinternet.com wrote: Out of curiosity, what the hell does dependently typed mean anyway? How about: The result type of a function may depend on the argument value (rather than just the argument type) The quoted bit rather than the parens bit

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Liam O'Connor
It means that not only can values have types, types can have values. An example of the uses of a dependent type would be to encode the length of a list in it's type. Due to the curry-howard isomorphism, dependent types open the gateway for lots of type-level theorem proving. On 26 June 2010

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Jason Dagit
On Sat, Jun 26, 2010 at 12:07 AM, Andrew Coppin andrewcop...@btinternet.com wrote: wren ng thornton wrote: And, as Jason said, if you're just interested in having the same programming style at both term and type levels, then you should look into dependently typed languages. Out of

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Jason Dagit
On Sat, Jun 26, 2010 at 12:27 AM, Jason Dagit da...@codersbase.com wrote: On Sat, Jun 26, 2010 at 12:07 AM, Andrew Coppin andrewcop...@btinternet.com wrote: wren ng thornton wrote: And, as Jason said, if you're just interested in having the same programming style at both term and type

[Haskell-cafe] Emacs script to align Haskell import list

2010-06-26 Thread Christopher Done
I whipped up a little Emacs script to align the import lines in the current buffer. I am using it in my projects and have experienced no problems. It's good at keeping within 80 columns. http://gist.github.com/453933 I've pasted it as a gist on Github so that anyone can edit it, gists also

Re: [Haskell-cafe] Manual Type-Checking to provide Read instances for GADTs. (was Re: [Haskell-cafe] Read instance for GATD)

2010-06-26 Thread Dupont Corentin
That's really nice. Very interesting. Thank you. On Fri, Jun 25, 2010 at 9:55 PM, Edward Kmett ekm...@gmail.com wrote: I've obtained permission to repost Gershom's slides on how to deserialize GADTs by typechecking them yourself, which are actually a literate haskell source file, that he was

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Andrew Coppin
Liam O'Connor wrote: It means that not only can values have types, types can have values. Uh, don't types have values *now*? An example of the uses of a dependent type would be to encode the length of a list in it's type. Oh, right. So you mean that as well as being able to say Foo

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Tony Morris
http://www.cs.nott.ac.uk/~txa/publ/ydtm.pdf Andrew Coppin wrote: Liam O'Connor wrote: It means that not only can values have types, types can have values. Uh, don't types have values *now*? An example of the uses of a dependent type would be to encode the length of a list in it's type.

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Andrew Coppin
Jason Dagit wrote: On Sat, Jun 26, 2010 at 12:07 AM, Andrew Coppin andrewcop...@btinternet.com mailto:andrewcop...@btinternet.com wrote: Out of curiosity, what the hell does dependently typed mean anyway? The types can depend on values. For example, have you ever notice we have

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Andrew Coppin
Tony Morris wrote: http://www.cs.nott.ac.uk/~txa/publ/ydtm.pdf Ah yes, it was definitely Epigram I looked at. The intro to this looked promising, but by about 3 pages in, I had absolutely no clue what on Earth the text is talking about... ___

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Gábor Lehel
On Sat, Jun 26, 2010 at 3:49 AM, wren ng thornton w...@freegeek.org wrote: Jason Dagit wrote: On Fri, Jun 25, 2010 at 2:26 PM, Walt Rorie-Baety black.m...@gmail.comwrote: I've noticed over the - okay, over the months - that some folks enjoy the puzzle-like qualities of programming in the

Re[2]: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Bulat Ziganshin
Hello Gábor, Saturday, June 26, 2010, 4:29:28 PM, you wrote: It's interesting how C++ is imperative at the term level and functional at the type level or logic? it supports indeterminate choice -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Felipe Lessa
On Sat, Jun 26, 2010 at 09:29:29AM +0300, Roman Beslik wrote: Incorrect encoding of filepaths is common in e.g. Cyrillic Linux (because of multiple possible encodings --- CP1251, KOI8-R, UTF-8) and is solved by fiddling with the current locale and media mount options. No need to change a

Re[2]: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Bulat Ziganshin
Hello Felipe, Saturday, June 26, 2010, 4:44:20 PM, you wrote: Even if we said we don't care, we at least should change FilePath to be [Word8], and not [String]. Currently filepaths are silently truncated if any codepoint is beyond 255. and there is no OS except Unix ;) -- Best regards,

Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Felipe Lessa
On Sat, Jun 26, 2010 at 04:48:39PM +0400, Bulat Ziganshin wrote: Saturday, June 26, 2010, 4:44:20 PM, Felipe Lessa wrote: Even if we said we don't care, we at least should change FilePath to be [Word8], and not [String]. Currently filepaths are silently truncated if any codepoint is beyond

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Liam O'Connor
I prefer Agda to Epigram, but different strokes for different folks. In agda, you could define a list indexed by its size like this: data Vec : (A : Set) → ℕ → Set where [] : Vec A 0 _∷_ : ∀ {n : ℕ} → A → Vec A n → Vec A (1 + n) So, we have a Vec data type, and on the type level it is a

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Liam O'Connor
We most certainly do have type-level functions. See type families. Cheers. ~Liam On 26 June 2010 17:33, Jason Dagit da...@codersbase.com wrote: On Sat, Jun 26, 2010 at 12:27 AM, Jason Dagit da...@codersbase.com wrote: On Sat, Jun 26, 2010 at 12:07 AM, Andrew Coppin

Re[2]: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Bulat Ziganshin
Hello Felipe, Saturday, June 26, 2010, 4:54:16 PM, you wrote: Even if we said we don't care, we at least should change FilePath to be [Word8], and not [String]. Currently filepaths other OSs worked fine, should I use this API (i.e. type FilePath = String) to its fullest extent, my

Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Felipe Lessa
On Sat, Jun 26, 2010 at 05:01:06PM +0400, Bulat Ziganshin wrote: Even if we said we don't care, we at least should change FilePath to be [Word8], and not [String]. Currently filepaths other OSs worked fine, should I use this API (i.e. type FilePath = String) to its fullest extent, my

Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Alexey Khudyakov
On Sat, 26 Jun 2010 10:14:50 -0300 Felipe Lessa felipe.le...@gmail.com wrote: On Sat, Jun 26, 2010 at 05:01:06PM +0400, Bulat Ziganshin wrote: but what you propose cannot be used in Windows at all! while current FilePath still works on Unix, with manual filenames en/decoding Now we got

[Haskell-cafe] Haskell Web Framework for newbies?

2010-06-26 Thread Giuseppe Luigi Punzi
Hi all, At the moment, I'm learning haskell and I would like to use the things I'm learning under web. I would like to mount a local web server, but I would like to test some things in my VPS in 11 with CentOs 5, but this, in a near future. For the moment, my doubt is, wich is the haskell

Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Felipe Lessa
On Sat, Jun 26, 2010 at 05:34:49PM +0400, Alexey Khudyakov wrote: It should solve most of problems I believe. But such change will break a lot of programs maybe most of them. How could one introduce such a change? One variant is to create new hierarchy and gradually deprecate old. Also same

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 6/26/10 07:28 , Andrew Coppin wrote: Uh, don't types have values *now*? To the extent that's true now, they're baked in; you can't do anything to/with them. Oh, right. So you mean that as well as being able to say Foo Bar, you can say Foo 7,

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread C. McCann
On Sat, Jun 26, 2010 at 3:27 AM, Jason Dagit da...@codersbase.com wrote: The types can depend on values.  For example, have you ever notice we have families of functions in Haskell like zip, zip3, zip4, ..., and liftM, liftM2, ...? Each of them has a type that fits into a pattern, mainly the

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Alexander Solla
On Jun 26, 2010, at 4:33 AM, Andrew Coppin wrote: It's a bit like trying to learn Prolog from somebody who thinks that the difference between first-order and second-order logic is somehow common knowledge. A first order logic quantifies over values, and a second order logic quantifies

[Haskell-cafe] Space leak with unsafePerformIO

2010-06-26 Thread Henning Thielemann
Attached is a program with a space leak that I do not understand. I have coded a simple 'map' function, once using unsafePerformIO and once without. UnsafePerformIO has a space leak in some circumstances. In the main program I demonstrate cases with and without space leak. Without space leak the

Re: [Haskell-cafe] Huffman Codes in Haskell

2010-06-26 Thread Tillmann Rendel
John Lato wrote: How would you implement bfnum? (If you've already read the paper, what was your first answer?) My first idea was something similar to what is described in appendix A. However, after reading the paper, I wrote the following code: data Tree a = E | T a (Tree a) (Tree a)

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Andrew Coppin
Alexander Solla wrote: On Jun 26, 2010, at 4:33 AM, Andrew Coppin wrote: It's a bit like trying to learn Prolog from somebody who thinks that the difference between first-order and second-order logic is somehow common knowledge. A first order logic quantifies over values, and a second

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Andrew Coppin
Brandon S Allbery KF8NH wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 6/26/10 07:28 , Andrew Coppin wrote: Oh, right. So you mean that as well as being able to say Foo Bar, you can say Foo 7, where 7 is (of course) a value rather than a type. (?) A bit more than that:

[Haskell-cafe] Re: Emacs script to align Haskell import list

2010-06-26 Thread Christopher Done
mauke from the Freenode IRC channel has contributed a vim version: http://gist.github.com/454255 On 26 June 2010 12:25, Christopher Done chrisd...@googlemail.com wrote: I whipped up a little Emacs script to align the import lines in the current buffer. I am using it in my projects and have

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Jason Dagit
On Sat, Jun 26, 2010 at 11:23 AM, Andrew Coppin andrewcop...@btinternet.com wrote: Brandon S Allbery KF8NH wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 6/26/10 07:28 , Andrew Coppin wrote: Oh, right. So you mean that as well as being able to say Foo Bar, you can say Foo 7,

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Alexander Solla
On Jun 26, 2010, at 11:21 AM, Andrew Coppin wrote: A first order logic quantifies over values, and a second order logic quantifies over values and sets of values (i.e., types, predicates, etc). The latter lets you express things like For every property P, P x. Notice that this

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 6/26/10 14:58 , Jason Dagit wrote: On Sat, Jun 26, 2010 at 11:23 AM, Andrew Coppin andrewcop...@btinternet.com mailto:andrewcop...@btinternet.com wrote: Brandon S Allbery KF8NH wrote: A bit more than that: imagine now that you can

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread Erik de Castro Lopo
Andrew Coppin wrote: Right, I see. So is there a specific reason why Haskell isn't dependently typed then? One problem with dependent types as I understand it is that type inference is not guaranteed to terminate. Erik --

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread C. McCann
On Sat, Jun 26, 2010 at 6:55 PM, Erik de Castro Lopo mle...@mega-nerd.com wrote: One problem with dependent types as I understand it is that type inference is not guaranteed to terminate. Full type inference is undecidable in most interesting type systems anyway. It's possible for the

Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Roman Beslik
On 26.06.10 16:34, Alexey Khudyakov wrote: On Sat, 26 Jun 2010 10:14:50 -0300 Felipe Lessafelipe.le...@gmail.com wrote: On Sat, Jun 26, 2010 at 05:01:06PM +0400, Bulat Ziganshin wrote: but what you propose cannot be used in Windows at all! while current FilePath still works on Unix, with

Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Roman Beslik
On 26.06.10 15:44, Felipe Lessa wrote: On Sat, Jun 26, 2010 at 09:29:29AM +0300, Roman Beslik wrote: Incorrect encoding of filepaths is common in e.g. Cyrillic Linux (because of multiple possible encodings --- CP1251, KOI8-R, UTF-8) and is solved by fiddling with the current locale and media

Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Felipe Lessa
On Sun, Jun 27, 2010 at 02:55:33AM +0300, Roman Beslik wrote: On 26.06.10 15:44, Felipe Lessa wrote: However, suppose your program needs to create a file with a name based on a database information. Your database is UTF-8. How do you translate that UTF-8 data into a filepath? This is the

Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Felipe Lessa
On Sun, Jun 27, 2010 at 02:52:54AM +0300, Roman Beslik wrote: On 26.06.10 16:34, Alexey Khudyakov wrote: On Sat, 26 Jun 2010 10:14:50 -0300 Felipe Lessafelipe.le...@gmail.com wrote: On Sat, Jun 26, 2010 at 05:01:06PM +0400, Bulat Ziganshin wrote: but what you propose cannot be used in

Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 6/26/10 19:52 , Roman Beslik wrote: I fail to see how it will brake programs. Current programs do not use Unicode because it is implemented incorrectly. Currently, FilePath is an alias for String. Changing FilePath to a real type will break

Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Felipe Lessa
On Sat, Jun 26, 2010 at 10:01:57PM -0300, Felipe Lessa wrote: The types are: getArgs :: IO [String] writeFile :: FilePath - String - IO () On a similar note, getArgs probably suffers from the same problem. Which should it be? a) getArgs :: IO [String] b) getArgs :: IO [Word8] c)

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread wren ng thornton
Gregory Crosswhite wrote: On 6/25/10 9:49 PM, wren ng thornton wrote: [1] http://eclipse-clp.org/ is currently down, but can be accessed at http://87.230.22.228/ [2] http://www.mercury.csse.unimelb.edu.au/ [3] http://www.lix.polytechnique.fr/~dale/lProlog/ [4]

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread wren ng thornton
Andrew Coppin wrote: Stephen Tetley wrote: On 26 June 2010 08:07, Andrew Coppin andrewcop...@btinternet.com wrote: Out of curiosity, what the hell does dependently typed mean anyway? How about: The result type of a function may depend on the argument value (rather than just the argument

Re: [Haskell-cafe] Type-Level Programming

2010-06-26 Thread wren ng thornton
Andrew Coppin wrote: I think I looked at Coq (or was it Epigram?) and found it utterly incomprehensible. Whoever wrote the document I was reading was obviously very comfortable with advanced mathematical abstractions which I've never even heard of. One of the things I've found when dealing