[Haskell-cafe] Data.Text UTF-8 question

2012-08-31 Thread jeff p
Hello, I have a sample file (attached) which I cannot read into Text: Prelude Control.Applicative Data.Text.IO.readFile foo *** Exception: utf8.txt: hGetContents: invalid argument (invalid byte sequence) Prelude Control.Applicative Data.Text.Encoding.decodeUtf8 $

[Haskell-cafe] ANNOUCE: monad-task-0.1.0, GLFW-task-0.1.0 and a tutorial on invert the inversion of control

2012-08-31 Thread Paul Liu
Graphics program often relies on system frameworks such as GLUT or GLFW to handle window and user input. But such frameworks often impose a rigid style of callback programming, or inversion of control. It is no secret that continuation monad can deal with this issue [1]. It is also known that

Re: [Haskell-cafe] Build regressions due to GHC 7.6

2012-08-31 Thread Alexander Kjeldaas
I think you're making this way harder than it really is. What 99% of people need is that hackage packages builds with the latest haskell platform, and/or with bleeding edge ghc, and with the latest versions of its dependencies. Thus for every dependency there is only one possible version - the

Re: [Haskell-cafe] Data.Text UTF-8 question

2012-08-31 Thread Gregory Collins
On Fri, Aug 31, 2012 at 7:59 AM, jeff p mutj...@gmail.com wrote: Hello, I have a sample file (attached) which I cannot read into Text: Prelude Control.Applicative Data.Text.IO.readFile foo *** Exception: utf8.txt: hGetContents: invalid argument (invalid byte sequence) Prelude

[Haskell-cafe] lambda.haskell.org is on an mxtools blacklist

2012-08-31 Thread jims
I had my subscription to haskell-cafe deleted because of intermittent bounces. I raised a support ticket with my ISP bluehost.com and they suggested the bounces might be because 78.46.100.80 is on the mxtoolbox blacklist as reported here:

Re: [Haskell-cafe] Sliding Window functional data structure

2012-08-31 Thread Ross Paterson
On Fri, Aug 31, 2012 at 05:45:27AM +0100, Richard O'Keefe wrote: Consider the following interface type Ord k = Sliding_Window k v entries :: Sliding_Window k v - [(k,v)] The cost is expected to be linear in the length of the result. The pairs are listed in

Re: [Haskell-cafe] why do I need class context in declaring data constructor?

2012-08-31 Thread Simon Peyton-Jones
Aha. See http://hackage.haskell.org/trac/ghc/ticket/7205. I don't think there's a workaround, I'm afraid Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe- | boun...@haskell.org] On Behalf Of Paul Liu | Sent: 30 August 2012 20:52 | To: Haskell

Re: [Haskell-cafe] Sliding Window functional data structure

2012-08-31 Thread ok
Any search tree implementation will do add and purge in O(log n) time. Add's obvious, but could you explain to me about purge? All of the explanations of search trees I'm familiar with, if they bother to explain deletion at all, talk about how to repair the balance of a tree after deleting

[Haskell-cafe] Sliding Window functional data structure

2012-08-31 Thread Okasaki, Christopher D CIV USA USMA
One possibility would be a random-access list (http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.55.5156), which is a kind of list of trees. Then 'add' is trivially O(1) and 'since' is trivially O(length result). The only tricky operation is purge, which naively would be O(N), where N is

Re: [Haskell-cafe] Function names in Haskell lib not first-class on web!

2012-08-31 Thread Brandon Allbery
On Thu, Aug 30, 2012 at 11:21 PM, damodar kulkarni kdamodar2...@gmail.comwrote: Note: google badly fails to search these functions identifiers. http://symbolhound.com/ -- brandon s allbery allber...@gmail.com wandering unix systems administrator

Re: [Haskell-cafe] Function names in Haskell lib not first-class on web!

2012-08-31 Thread damodar kulkarni
thanks for the symbolhound link. @Kristopher: I knew hoogle to some extent, not an expert user though. and, it seems, the hoogle plugin for firefox works only for haskell.org Damodar On Fri, Aug 31, 2012 at 8:07 PM, Brandon Allbery allber...@gmail.comwrote: On Thu, Aug 30, 2012 at 11:21 PM,

[Haskell-cafe] Is it worth adding Gaussian elimination and eigenvalues to REPA?

2012-08-31 Thread KC
I realize if one wants speed you probably want to use the hMatrix interface to GSL, BLAS and LAPACK. Worth it in the sense of have a purely functional implementation. -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Over general types are too easy to make.

2012-08-31 Thread timothyhobbs
I'd have to say that there is one(and only one) issue in Haskell that bugs me to the point where I start to think it's a design flaw: It's much easier to type things over generally than it is to type things correctly. Say we have a data BadFoo = BadBar{   badFoo::Int} | BadFrog{  

Re: [Haskell-cafe] why do I need class context in declaring data constructor?

2012-08-31 Thread Paul Liu
Thanks, Simon! I'll be looking forward to its resolution. On Fri, Aug 31, 2012 at 4:37 AM, Simon Peyton-Jones simo...@microsoft.com wrote: Aha. See http://hackage.haskell.org/trac/ghc/ticket/7205. I don't think there's a workaround, I'm afraid Simon | -Original Message- | From:

Re: [Haskell-cafe] Over general types are too easy to make.

2012-08-31 Thread John Wiegley
timothyho...@seznam.cz writes: data BadFoo = BadBar{ badFoo::Int} | BadFrog{ badFrog::String, badChicken::Int} This is fine, until we want to write a function that acts on Frogs but not on Bars. The best we can do is throw a runtime error when passed a Bar and not a Foo: You can

Re: [Haskell-cafe] Over general types are too easy to make.

2012-08-31 Thread timothyhobbs
Sure, but that's relying on the promise that you're passing it a valid BadFrog...  Consider then: deBadFrog $ BadFrogType (BadBar { badFoo = 1}) -- Původní zpráva -- Od: John Wiegley jo...@newartisans.com Datum: 31. 8. 2012 Předmět: Re: [Haskell-cafe] Over general types

[Haskell-cafe] Code review request - using ErrorT

2012-08-31 Thread C K Kashyap
Dear gentle Haskellers, I'd appreciate it very much if you could please take a look the my code here and give me some feedback - https://github.com/ckkashyap/haskell-websocket/blob/master/src/lib/Net/WebSocket/Request.hs I am particularly looking for advice around what would be a good type for

Re: [Haskell-cafe] Is it worth adding Gaussian elimination and eigenvalues to REPA?

2012-08-31 Thread Ben Gamari
KC kc1...@gmail.com writes: I realize if one wants speed you probably want to use the hMatrix interface to GSL, BLAS and LAPACK. Worth it in the sense of have a purely functional implementation. I, for one, have needed these in the past and far prefer Repa's interface to that of hMatrix. I

Re: [Haskell-cafe] Over general types are too easy to make.

2012-08-31 Thread Paolino
Hello Timothy GADTs let you catch more errors at compile time. With them you can give different types to constructors of the same datatype. regards paolino 2012/8/31 timothyho...@seznam.cz Sure, but that's relying on the promise that you're passing it a valid BadFrog... Consider then:

Re: [Haskell-cafe] Over general types are too easy to make.

2012-08-31 Thread Austin Seipp
What you are essentially asking for is a refinement on the type of 'BadFoo' in the function type, such that the argument is provably always of a particular constructor. The easiest way to encode this kind of property safely with Haskell 2010 as John suggested is to use phantom types and use the

Re: [Haskell-cafe] Data.Text UTF-8 question

2012-08-31 Thread Albert Y. C. Lai
On 12-08-31 01:59 AM, jeff p wrote: I have a sample file (attached) which I cannot read into Text: Prelude Control.Applicative Data.Text.IO.readFile foo *** Exception: utf8.txt: hGetContents: invalid argument (invalid byte sequence) Prelude Control.Applicative

Re: [Haskell-cafe] Over general types are too easy to make.

2012-08-31 Thread Nick Vanderweit
It is often the case that using GADTs with phantom types can allow you to constrain which functions can operate on the results of which constructors. I believe this is common practice now in such situations. Nick On Friday, August 31, 2012 09:32:37 PM Paolino wrote: Hello Timothy GADTs

Re: [Haskell-cafe] Function names in Haskell lib not first-class on web!

2012-08-31 Thread Ivan Lazar Miljenovic
On 1 September 2012 01:11, damodar kulkarni kdamodar2...@gmail.com wrote: I knew hoogle to some extent, not an expert user though. and, it seems, the hoogle plugin for firefox works only for haskell.org Because Hoogle indexes the packages on Hackage. Where else can it find it Haskell source

[Haskell-cafe] Yesod a href render issue

2012-08-31 Thread Thiago Negri
I'm following Yesod tutorial that gives this as the first example for type-safe URLs: | getHomeR = defaultLayout [whamlet|a href=@{Page1R}Go to page 1!|] Worked fine, the a href generated looks perfect. Then I tried this: | getHomeR = defaultLayout [whamlet|Hello!a href=@{Page1R}Go to page

Re: [Haskell-cafe] Yesod a href render issue

2012-08-31 Thread David McBride
Hamlet is whitespace sensitive like haskell and python. If you put a tag after text, it is treated as text. Write the a... on the next line and it will work. On Fri, Aug 31, 2012 at 7:14 PM, Thiago Negri evoh...@gmail.com wrote: I'm following Yesod tutorial that gives this as the first

Re: [Haskell-cafe] Build regressions due to GHC 7.6

2012-08-31 Thread Jay Sulzberger
On Fri, 31 Aug 2012, Alexander Kjeldaas alexander.kjeld...@gmail.com wrote: I think you're making this way harder than it really is. What 99% of people need is that hackage packages builds with the latest haskell platform, and/or with bleeding edge ghc, and with the latest versions of its

Re: [Haskell-cafe] Yesod a href render issue

2012-08-31 Thread Felipe Almeida Lessa
On Fri, Aug 31, 2012 at 9:45 PM, David McBride toa...@gmail.com wrote: Hamlet is whitespace sensitive like haskell and python. If you put a tag after text, it is treated as text. Write the a... on the next line and it will work. Another option is to manually put the closing /a when the tag

Re: [Haskell-cafe] [Haskell] ANNOUNCE: Perdure

2012-08-31 Thread Patrick Premont
We will work on releasing more interesting examples. For now there are only the test files such as https://github.com/Cognimeta/perdure/blob/7b6cbe80d1fc735f697b3ee148b01eb57c4079fa/exe-src/Database/Perdure/TestState.hs. There were many internals that are needlessly exposed. We've hidden them

[Haskell-cafe] Compiling a haskell project as a shared library and loading it in C/C++

2012-08-31 Thread Farid Neshat
So I'm trying to follow [this blog][1]. So I tried the code, couldn't compile the haskell part, probably due to the fact the guide uses version 6, but I have version 7 of ghc. By changing the paramaters I could compile it with the following: ghc --make -dynamic -shared -fPIC -no-hs-main -optl