Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread MigMit
On 22 Dec 2011, at 06:25, Alexander Solla wrote: > Denotational semantics is unrealistic. And so are imaginary numbers. But they are damn useful for electrical circuits calculations, so who cares? > The /defining/ feature of a bottom is that it doesn't have an interpretation. What do you mean

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Gregory Crosswhite
On Dec 22, 2011, at 12:40 PM, Alexander Solla wrote: > > fst _|_ = _|_ > > This expression is basically non-sense. This is only "nonsense" because you refuse to accept that there are valid formalisms other than your own that contain _|_ as a perfectly valid entity. :-) > Should we a

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Gregory Crosswhite
On Dec 22, 2011, at 12:25 PM, Alexander Solla wrote: > It is not "limiting" to make distinctions that capture real differences. An > overly broad generalization limits what can be proved. Can we prove that > every vehicle with wheels has a motor? Of course not -- bicycles exist. Can > we p

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Lyndon Maydwell
I would make the 'type' symbol a single character ala Agda. For example, a : Int If your users are writing a lot of types, make it easy! On Dec 22, 2011 10:42 AM, "Alexander Solla" wrote: > > > On Tue, Dec 20, 2011 at 10:30 PM, Gregory Crosswhite < > gcrosswh...@gmail.com> wrote: > >> >> On D

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Alexander Solla
On Tue, Dec 20, 2011 at 10:30 PM, Gregory Crosswhite wrote: > > On Dec 21, 2011, at 2:24 PM, Alexander Solla wrote: > > I would rather have an incomplete semantic, and have all the incomplete > parts collapsed into something we call "bottom". We can then be smart and > stay within a total fragmen

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Alexander Solla
On Tue, Dec 20, 2011 at 9:16 PM, MigMit wrote: > > On 21 Dec 2011, at 08:24, Alexander Solla wrote: > > > I would rather have an incomplete semantic, and have all the incomplete > parts collapsed into something we call "bottom". > > I don't see the reason to limit ourselves to that. Of course, in

Re: [Haskell-cafe] State Machine Composition

2011-12-21 Thread Daniel Waterworth
I suspect it's possible to do something like that with multi parameter type classes, but I tend to find that trying to do pseudo dependently typed things in Haskell tends to bite me sooner or later. Daniel On 21 December 2011 22:24, Nicolas Trangez wrote: > On Wed, 2011-12-21 at 18:34 +, Dan

Re: [Haskell-cafe] State Machine Composition

2011-12-21 Thread Nicolas Trangez
On Wed, 2011-12-21 at 18:34 +, Daniel Waterworth wrote: > I made this simple state machine combinator library today. I think it > works as a simple example of a good use for GADTs. > > https://gist.github.com/1507107 Any way to do something along the lines of type StateChange a = SC a a han

[Haskell-cafe] How to define Storable instance for data constructor with storable vectors

2011-12-21 Thread Sanket Agrawal
I am trying to write a union data structure which can store vectors - a simplified definition of data structure is below: - -- V is Data.Vector.Storable data Elems = I {-# UNPACK #-} !GHC.Int.Int32 | S {-# UNPACK #-} !GHC.Int.Int32 {-# UNPACK #-} !(Ptr CChar)

Re: [Haskell-cafe] Alternative versus Monoid

2011-12-21 Thread David Menendez
On Wed, Dec 21, 2011 at 8:10 AM, Bas van Dijk wrote: > On 16 December 2011 16:26, Yves Parès wrote: >> "1) What about the First type? Do we {-# DEPRECATE #-} it?" >> >> Personnaly, I'm in favor of following the same logic than Int: >> Int itself is not a monoid. You have to be specific: it's eith

Re: [Haskell-cafe] Alternative versus Monoid

2011-12-21 Thread Matthew Farkas-Dyck
On 21/12/2011, Bas van Dijk wrote: > On 16 December 2011 16:26, Yves Parès wrote: >> "1) What about the First type? Do we {-# DEPRECATE #-} it?" >> >> Personnaly, I'm in favor of following the same logic than Int: >> Int itself is not a monoid. You have to be specific: it's either Sum or >> Mult.

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Ivan Perez
> In Haskell, most of these assumptions are invalid: > >      * something may be curried or member of a strange typeclass (like >        printf). No assumptions about the number of arguments can be >        made >      * It may be possible that we do not yet know the type of a because >        we c

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Robert Clausecker
Am Mittwoch, den 21.12.2011, 20:05 +0100 schrieb Ivan Perez: > >> - Function overloading without classes. If it's not done, there must > >> be a good reason for it > >> (many good reasons, probably), but I really miss it. > > > > That does not play well with type inference. > > I understand that.

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Ivan Perez
>> - Function overloading without classes. If it's not done, there must >> be a good reason for it >> (many good reasons, probably), but I really miss it. > > That does not play well with type inference. I understand that. But it may be ok in many simple situations, which is actually where I tend

Re: [Haskell-cafe] "mapping" an Enumerator

2011-12-21 Thread John Millikin
The presence of (Step b m r) is an artifact of Haskell's type system. It can be removed through use of language extensions and 'forall' to give a more aesthetically pleasing signature, but there should be no behavioral difference. On Wed, Dec 21, 2011 at 03:26, Michael Snoyman wrote: > On Wed, De

[Haskell-cafe] State Machine Composition

2011-12-21 Thread Daniel Waterworth
I made this simple state machine combinator library today. I think it works as a simple example of a good use for GADTs. https://gist.github.com/1507107 Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listin

Re: [Haskell-cafe] [Alternative] change some/many semantics

2011-12-21 Thread David Menendez
On Wed, Dec 21, 2011 at 12:37 PM, wren ng thornton wrote: > On 12/19/11 10:20 PM, David Menendez wrote: >> >> On Mon, Dec 19, 2011 at 6:37 PM, wren ng thornton >>  wrote: >>> >>> On 12/14/11 10:58 PM, Gregory Crosswhite wrote: Of course, this is not a simple change at all because it

Re: [Haskell-cafe] guided seq (Was: Interruptible threads with IO loops)

2011-12-21 Thread Joachim Breitner
Dear Wren, Am Mittwoch, den 21.12.2011, 13:04 -0500 schrieb wren ng thornton: > On 12/21/11 4:31 AM, Joachim Breitner wrote: > > This would be particularly handy when with, for example > > snd tuple `evaluateUntilItDoesNotNeed` tuple > > where the tuple is unevaluated in the right compone

Re: [Haskell-cafe] The Riddle of the Buddhist Monk

2011-12-21 Thread Patrick Browne
On 21/12/11, Richard O'Keefe wrote:So what exactly is the program supposed to do?  I am trying to see whether Haskell modules can be used for blending[1].  The original MAUDE [2,3] program just sets up an arbitrary meeting point, which is assumed to be time-2 and location-2. Then in MONK_MEETS_

Re: [Haskell-cafe] Alternative versus Monoid

2011-12-21 Thread David Menendez
On Wed, Dec 21, 2011 at 12:20 PM, Conor McBride wrote: > > On 21 Dec 2011, at 14:07, Erik Hesselink wrote: > >> On Wed, Dec 21, 2011 at 14:10, Bas van Dijk wrote: > > >>  The semantics of Maybe are >>> >>> >>> clear: it's failure-and-prioritized-choice. >> >> >> Are you sure? > > > Yes. > > >> T

Re: [Haskell-cafe] guided seq (Was: Interruptible threads with IO loops)

2011-12-21 Thread wren ng thornton
On 12/21/11 4:31 AM, Joachim Breitner wrote: This would be particularly handy when with, for example snd tuple `evaluateUntilItDoesNotNeed` tuple where the tuple is unevaluated in the right component (and where we don’t want to force this just now), but retains something large in the lef

Re: [Haskell-cafe] Mitigating state-threading through an application loop

2011-12-21 Thread wren ng thornton
On 12/20/11 11:08 AM, Michael Serra wrote: Hello Haskellers, I'm implementing a simple tree-manipulating (for sports tournaments) application prototype, with SDL for graphics and simple user interaction. For reference, I've posted the code on hpaste. My question is abo

Re: [Haskell-cafe] [Alternative] change some/many semantics

2011-12-21 Thread wren ng thornton
On 12/19/11 10:20 PM, David Menendez wrote: On Mon, Dec 19, 2011 at 6:37 PM, wren ng thornton wrote: On 12/14/11 10:58 PM, Gregory Crosswhite wrote: Of course, this is not a simple change at all because it would have to be done in such a way as to respect the ordering of actions --- that is,

Re: [Haskell-cafe] Alternative versus Monoid

2011-12-21 Thread Conor McBride
On 21 Dec 2011, at 14:07, Erik Hesselink wrote: On Wed, Dec 21, 2011 at 14:10, Bas van Dijk wrote: The semantics of Maybe are clear: it's failure-and-prioritized-choice. Are you sure? Yes. There are (at least) four Monoid instances for Maybe [1]. With a direct instance for May

Re: [Haskell-cafe] ANNOUNCE: partial-lens 0.0.1

2011-12-21 Thread Erik Hesselink
On Wed, Dec 21, 2011 at 16:39, wrote: > On Wed, 21 Dec 2011, Erik Hesselink wrote: > >> How does this relate to the Maybe lenses in fclabels [1]? >> >> Erik >> >> [1] >> http://hackage.haskell.org/packages/archive/fclabels/1.0.4/doc/html/Data-Label-Maybe.html > > > It appears to be somewhere betw

Re: [Haskell-cafe] ANNOUNCE: partial-lens 0.0.1

2011-12-21 Thread roconnor
On Wed, 21 Dec 2011, Erik Hesselink wrote: How does this relate to the Maybe lenses in fclabels [1]? Erik [1] http://hackage.haskell.org/packages/archive/fclabels/1.0.4/doc/html/Data-Label-Maybe.html It appears to be somewhere between similar and the same. *** Comparison of API Data.Label

Re: [Haskell-cafe] Alternative versus Monoid

2011-12-21 Thread Erik Hesselink
On Wed, Dec 21, 2011 at 14:10, Bas van Dijk wrote: > On 16 December 2011 16:26, Yves Parès wrote: >> "1) What about the First type? Do we {-# DEPRECATE #-} it?" >> >> Personnaly, I'm in favor of following the same logic than Int: >> Int itself is not a monoid. You have to be specific: it's either

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Robert Clausecker
Am 21.12.2011 14:10 schrieb "Ivan Perez" : > > In general, I like haskell the way it is, but there are a few things > that I would like to see: > (I am no language designer, so I don't know about the theoretical > implications that these > might have. Also, let me know if there exists a clean way t

Re: [Haskell-cafe] Interruptible threads with IO loops

2011-12-21 Thread Bas van Dijk
On 21 December 2011 09:52, Fedor Gogolev wrote: > I'm trying to get some threads that I can stop and get last > values that was computed (and that values are IO values, in fact). I'm not sure it's what you need but you might want to look at: http://hackage.haskell.org/package/Workflow Bas

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Ivan Perez
In general, I like haskell the way it is, but there are a few things that I would like to see: (I am no language designer, so I don't know about the theoretical implications that these might have. Also, let me know if there exists a clean way to do any of the following): - Using subranges of insta

Re: [Haskell-cafe] Alternative versus Monoid

2011-12-21 Thread Bas van Dijk
On 16 December 2011 16:26, Yves Parès wrote: > "1) What about the First type? Do we {-# DEPRECATE #-} it?" > > Personnaly, I'm in favor of following the same logic than Int: > Int itself is not a monoid. You have to be specific: it's either Sum or > Mult. > > It should be the same for Maybe: we re

Re: [Haskell-cafe] guided seq (Was: Interruptible threads with IO loops)

2011-12-21 Thread Felipe Almeida Lessa
On Wed, Dec 21, 2011 at 7:31 AM, Joachim Breitner wrote: > this problem comes up in various places; forcing the whole thunk is of > course an option, but would it be possible – theoretical, with the GHC > runtime, or even with current tools – to have a function >        evaluateUntilItDoesNotNeed

[Haskell-cafe] guided seq (Was: Interruptible threads with IO loops)

2011-12-21 Thread Joachim Breitner
Hi, Am Mittwoch, den 21.12.2011, 19:15 +1000 schrieb Gregory Crosswhite: > I don't have any tips for cleaning up the code off the top of my head, > but I suspect that the memory leak is coming from the fact that the > expression (v+1) is not being forced, which means that each iteration > of the

Re: [Haskell-cafe] "mapping" an Enumerator

2011-12-21 Thread Erik de Castro Lopo
Kannan Goundan wrote: > You're right -- now that I think about it, I don't really care what the > type of 'r' is. (Boy, I could have saved several hours today if I had > realized that earlier :-) I seem to be hitting exactly the same problem. I constrain my types too early and the compiler can

[Haskell-cafe] Test

2011-12-21 Thread Ertugrul Söylemez
This is a test. Please disregard. -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/ signature.asc Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-c

Re: [Haskell-cafe] "mapping" an Enumerator

2011-12-21 Thread Kannan Goundan
Michael Snoyman wrote: > On Wed, Dec 21, 2011 at 12:59 PM, Kannan Goundan > wrote: >> Michael Snoyman wrote: >> >>> On Wed, Dec 21, 2011 at 12:35 PM, Kannan Goundan >>> wrote: I'm using the Data.Enumerator library.  I'm trying to write a "map" function that converts an Enumerator of on

Re: [Haskell-cafe] ANNOUNCE: partial-lens 0.0.1

2011-12-21 Thread Erik Hesselink
How does this relate to the Maybe lenses in fclabels [1]? Erik [1] http://hackage.haskell.org/packages/archive/fclabels/1.0.4/doc/html/Data-Label-Maybe.html On Wed, Dec 21, 2011 at 04:54, wrote: > Do you miss null references from your old imperative programming days? Wish > that the worlds be

Re: [Haskell-cafe] "mapping" an Enumerator

2011-12-21 Thread Michael Snoyman
On Wed, Dec 21, 2011 at 12:59 PM, Kannan Goundan wrote: > Michael Snoyman wrote: > >> On Wed, Dec 21, 2011 at 12:35 PM, Kannan Goundan >> wrote: >>> I'm using the Data.Enumerator library.  I'm trying to write a "map" >>> function that converts an Enumerator of one type to another. Something >>> l

Re: [Haskell-cafe] "mapping" an Enumerator

2011-12-21 Thread Kannan Goundan
Michael Snoyman wrote: > On Wed, Dec 21, 2011 at 12:35 PM, Kannan Goundan > wrote: >> I'm using the Data.Enumerator library.  I'm trying to write a "map" >> function that converts an Enumerator of one type to another. Something >> like: >> >>   mapEnum :: Monad m => >>          (a -> b) -> >>    

[Haskell-cafe] Haskell meta-programming

2011-12-21 Thread John Lato
> From: Heinrich Apfelmus > > * Meta-programming / partial evaluation. When designing a DSL, it is > often the case that you know how to write an optimizing compiler for > your DSL because it's usually a first-order language. However, trying to > squeeze that into GHC rules is hopeless. Having som

Re: [Haskell-cafe] "mapping" an Enumerator

2011-12-21 Thread Michael Snoyman
On Wed, Dec 21, 2011 at 12:35 PM, Kannan Goundan wrote: > I'm using the Data.Enumerator library.  I'm trying to write a "map" > function that converts an Enumerator of one type to another. > Something like: > >   mapEnum :: Monad m => >          (a -> b) -> >          Enumerator a m r -> >        

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Hans Aberg
On 21 Dec 2011, at 11:22, Andrew Coppin wrote: > On 21/12/2011 10:09 AM, Jesse Schalken wrote: >> IIRC, Scite's default configuration is with non-monospace font. I >> actually found it quite appealing, and in fact forgot about it entirely >> after some usage. It is much easier on the eyes to read.

[Haskell-cafe] "mapping" an Enumerator

2011-12-21 Thread Kannan Goundan
I'm using the Data.Enumerator library. I'm trying to write a "map" function that converts an Enumerator of one type to another. Something like: mapEnum :: Monad m => (a -> b) -> Enumerator a m r -> Enumerator b m r Any hints? (My exact use case is that I have a

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Hans Aberg
On 21 Dec 2011, at 11:09, Jesse Schalken wrote: > IIRC, Scite's default configuration is with non-monospace font. I actually > found it quite appealing, and in fact forgot about it entirely after some > usage. It is much easier on the eyes to read. The difference is really > whether you care ab

Re: [Haskell-cafe] OOM when linking, increasingly a problem

2011-12-21 Thread Felipe Almeida Lessa
On Wed, Dec 21, 2011 at 8:18 AM, Magnus Therning wrote: > Sure, I can do that, but it would be even better to express > dissatisfaction and suggest a way to fix it.  I don't have any idea of > what's going on though.  Anyone with deeper knowledge? The problem with that module is cpolysArr. An id

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Andrew Coppin
On 21/12/2011 10:09 AM, Jesse Schalken wrote: IIRC, Scite's default configuration is with non-monospace font. I actually found it quite appealing, and in fact forgot about it entirely after some usage. It is much easier on the eyes to read. The difference is really whether you care about aligning

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Gregory Crosswhite
On Dec 20, 2011, at 11:18 PM, Heinrich Apfelmus wrote: > Tillmann Rendel wrote: >> Hi, >> Robert Clausecker wrote: >>> Image you would create your own language with a paradigm similar to >>> Haskell or have to chance to change Haskell without the need to keep any >>> compatibility. What stuff wou

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Andrew Coppin
On 19/12/2011 07:20 PM, Robert Clausecker wrote: Image you would create your own language with a paradigm similar to Haskell or have to chance to change Haskell without the need to keep any compatibility. What stuff would you add to your language, what stuff would you remove and what problems wou

Re: [Haskell-cafe] OOM when linking, increasingly a problem

2011-12-21 Thread Magnus Therning
On Wed, Dec 21, 2011 at 10:00, Felipe Almeida Lessa wrote: > On Wed, Dec 21, 2011 at 4:06 AM, Magnus Therning wrote: >> I've started to run out of memory when linking certain packages.  The >> culprits at the moment are crypto-api (Crypto.CPoly) and >> Agda-executable. > [snip] >> crypto-api is a

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Hans Aberg
On 21 Dec 2011, at 11:03, Brandon Allbery wrote: > On Wed, Dec 21, 2011 at 04:51, Hans Aberg wrote: >> The one on the list is not a mathematical symbol. It should be ⋆ STAR >> OPERATOR U+22C6 or ∗ ASTERISK OPERATOR U+2217. >> > ...except, at least in my current font, the former is microscopic a

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Jesse Schalken
IIRC, Scite's default configuration is with non-monospace font. I actually found it quite appealing, and in fact forgot about it entirely after some usage. It is much easier on the eyes to read. The difference is really whether you care about aligning things mid-line or not, not to mention editor s

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Brandon Allbery
On Wed, Dec 21, 2011 at 04:51, Hans Aberg wrote: > The one on the list is not a mathematical symbol. It should be ⋆ STAR > OPERATOR U+22C6 or ∗ ASTERISK OPERATOR U+2217. > ...except, at least in my current font, the former is microscopic and the latter not a whole lot better. The advantage of th

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Hans Aberg
On 21 Dec 2011, at 04:27, Ashok Gautham wrote: > On Tue, Dec 20, 2011 at 11:17:32PM +0100, Hans Aberg wrote: >> The monospace characters U+1D670-1D6A3 might be used for keywords. Font: >> http://www.stixfonts.org/ > > I feel that monospace fonts should be used for all of programming. A > languag

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-21 Thread Hans Aberg
On 21 Dec 2011, at 04:15, Brandon Allbery wrote: > On Tue, Dec 20, 2011 at 21:05, Andrew Cowie > wrote: >> Now we just need λ to replace \, → to replace ->, and ≠ to replace /= >> (which still looks like division assignment no matter how hard I squint >> my eyes. 25 years of C and C derived lang

Re: [Haskell-cafe] Interruptible threads with IO loops

2011-12-21 Thread Gregory Crosswhite
On Dec 21, 2011, at 6:52 PM, Fedor Gogolev wrote: > Hello. I'm trying to get some threads that I can stop and get last > values that was computed (and that values are IO values, in fact). > Here is my first approach: > [...] > tick :: Int -> IO Int > tick v = return $ v + 1 > [...] > The problem

Re: [Haskell-cafe] Interruptible threads with IO loops

2011-12-21 Thread Felipe Almeida Lessa
Suggestion: use an IORef and asynchronous exceptions, see below for untested code. On Wed, Dec 21, 2011 at 6:52 AM, Fedor Gogolev wrote: > Hello. I'm trying to get some threads that I can stop and get last > values that was computed (and that values are IO values, in fact). > Here is my first app

Re: [Haskell-cafe] OOM when linking, increasingly a problem

2011-12-21 Thread Felipe Almeida Lessa
On Wed, Dec 21, 2011 at 4:06 AM, Magnus Therning wrote: > I've started to run out of memory when linking certain packages.  The > culprits at the moment are crypto-api (Crypto.CPoly) and > Agda-executable. [snip] > crypto-api is a library package, so I some similar trick isn't really > a possibili

[Haskell-cafe] Interruptible threads with IO loops

2011-12-21 Thread Fedor Gogolev
Hello. I'm trying to get some threads that I can stop and get last values that was computed (and that values are IO values, in fact). Here is my first approach: module Main where import Control.Concurrent (MVar, threadDelay, forkIO, newMVar, putMVar, readMVar) tick :: Int -> IO Int tick v = retu