Re: [Haskell-cafe] What extension do I need to write "type Job = Map k a"?

2012-06-13 Thread Magicloud Magiclouds
I think I need to think this through

On Thu, Jun 14, 2012 at 12:28 PM, Ivan Lazar Miljenovic
 wrote:
> On 14 June 2012 14:20, Magicloud Magiclouds
>  wrote:
>> OK. I think I understand a little.
>> I use Job here just wants to simplify the code. And since I provide
>> the function as library, I cannot decide what exact type k is. What
>> should I do?
>
> Do you know what the type of `a'?  If so:
>
> type Job k = Map k String
>
> Otherwise... do you even need a type alias?
>
>>
>> On Thu, Jun 14, 2012 at 11:23 AM, Arlen Cuss  wrote:
>>> (resending to café, turns out I wasn't subbed from this address.)
>>>
>>> Hi Magicloud,
>>> This is correct; because you've hidden the type-variables away by 
>>> universally quantifying them, there's no more level of specificity you can 
>>> get back *out* of them than just "some kind of Map" (Job = M.Map k b, where 
>>> k ≠ k0, b ≠ b0).
>>>
>>> If you have a Job type which can store *any* kind of Map (forall k a. Job 
>>> (Map k a)), then that means you could have a Job with a Map Int Bool, and a 
>>> Job with a Map String (Float -> Float), and they'd both have the same type 
>>> "Job". You can't do anything with the values within, because you're being 
>>> too permissive about what a Job is.
>>>
>>> You may want "data Job k a = Job (Map k a)", *or* if you do actually use 
>>> one kind of Map only, then why not "data Job = Job (Map Int String)" 
>>> (substituting your real types for Int and String). In this case, you could 
>>> also consider using newtype ("newtype Job = Job { getJob :: Map Int String 
>>> }") to provide the guarantee that you're getting a Job (and not any Map Int 
>>> String) without performance loss.
>>>
>>> Let me know if I've been more confusing than helpful;
>>>
>>> Arlen
>>>
>>>
>>> On Thursday, 14 June 2012 at 1:16 PM, Magicloud Magiclouds wrote:
>>>
 Hi there,
 Thanks for the reply. To be clear, all I want is to "avoid having to
 type type variables all over the place". What should I do? My original
 code with RankNTypes and ImpredicativeTypes does not work

 The "type Job = forall k a. M.Map k a" works now. But function uses
 it does not. Compiler complains about "Couldn't match expected type
 `Job' with actual type `M.Map k0 b0'".

 On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles >>> (mailto:pumpkin...@gmail.com)> wrote:
 That doesn't require existential quantification, but it'll need Rank-2 
 typesif you ever do anything with Job. Unfortunately, a universally 
 quantifiedJob like what you wrote (or what Magicloud seems to want) is 
 only inhabitedby the empty Map.
 >
 An existentially quantified Job, as you might get with
 >
 data Job = forall k a. Job (Map k a)
 >
 does let you wrap up any Map containing anything in it, but 
 unfortunatelythe only thing you can do with that map afterwards is ask for 
 "structural"properties about it, like whether it's empty or how many 
 elements it has init. You could ask to enumerate the elements in it, but 
 you wouldn't be ableto touch any of them because you wouldn't know what 
 their types were.
 >
 So I'm not really sure how to interpret the question. Was the goal to have 
 aheterogeneous Map, maybe? Or just to avoid having to type type variables 
 allover the place? Both of those are possible but require a bit 
 moresophistication with types.
 >
 -Dan
 >
 >
 On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa 
 Paletmailto:ifiguer...@gmail.com)> wrote:
 > >
 Do you want to hide the specific types of the job? Presumably to 
 thendefine a type JobList = [Job] ?You can do that with the 
 ExistentialQuantification extension.
 > >
 type Job = forall k a. Map k atype JobList = [Job]
 > >
 ??Note you can't unpack the types k a once you have hidden them. But 
 thetypechecker can use it to ensure some static property.Also you could 
 use unsafeCoerce to do some casts, but *only if you are*sure* that things 
 will go OK*.
 > >
 > >
 2012/6/13 Magicloud Magiclouds >>> (mailto:magicloud.magiclo...@gmail.com)>
 > > >
 Hi,I've forgotten this.This is OK:type Job k a = Map k aAnd this is OK:{-# 
 LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?type Job = forall a. 
 forall k. Map k a
 > > >
 Then how to write it like this?type Job = Map k a--竹密岂妨流水过山高哪阻野云飞
 > > >
 And for G+, please use magiclouds#gmail.com (http://gmail.com).
 > > >
 ___Haskell-Cafe mailing 
 listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org)
 > > > http://www.haskell.org/mailman/listinfo/haskell-cafe
 > >
 > >
 > >
 > >
 > >
 > >
 > >
 > >
 --Ismael
 > >
 > >
 ___Haskell-Cafe mailing 
 listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org)
>>

Re: [Haskell-cafe] What extension do I need to write "type Job = Map k a"?

2012-06-13 Thread Ivan Lazar Miljenovic
On 14 June 2012 14:20, Magicloud Magiclouds
 wrote:
> OK. I think I understand a little.
> I use Job here just wants to simplify the code. And since I provide
> the function as library, I cannot decide what exact type k is. What
> should I do?

Do you know what the type of `a'?  If so:

type Job k = Map k String

Otherwise... do you even need a type alias?

>
> On Thu, Jun 14, 2012 at 11:23 AM, Arlen Cuss  wrote:
>> (resending to café, turns out I wasn't subbed from this address.)
>>
>> Hi Magicloud,
>> This is correct; because you've hidden the type-variables away by 
>> universally quantifying them, there's no more level of specificity you can 
>> get back *out* of them than just "some kind of Map" (Job = M.Map k b, where 
>> k ≠ k0, b ≠ b0).
>>
>> If you have a Job type which can store *any* kind of Map (forall k a. Job 
>> (Map k a)), then that means you could have a Job with a Map Int Bool, and a 
>> Job with a Map String (Float -> Float), and they'd both have the same type 
>> "Job". You can't do anything with the values within, because you're being 
>> too permissive about what a Job is.
>>
>> You may want "data Job k a = Job (Map k a)", *or* if you do actually use one 
>> kind of Map only, then why not "data Job = Job (Map Int String)" 
>> (substituting your real types for Int and String). In this case, you could 
>> also consider using newtype ("newtype Job = Job { getJob :: Map Int String 
>> }") to provide the guarantee that you're getting a Job (and not any Map Int 
>> String) without performance loss.
>>
>> Let me know if I've been more confusing than helpful;
>>
>> Arlen
>>
>>
>> On Thursday, 14 June 2012 at 1:16 PM, Magicloud Magiclouds wrote:
>>
>>> Hi there,
>>> Thanks for the reply. To be clear, all I want is to "avoid having to
>>> type type variables all over the place". What should I do? My original
>>> code with RankNTypes and ImpredicativeTypes does not work
>>>
>>> The "type Job = forall k a. M.Map k a" works now. But function uses
>>> it does not. Compiler complains about "Couldn't match expected type
>>> `Job' with actual type `M.Map k0 b0'".
>>>
>>> On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles >> (mailto:pumpkin...@gmail.com)> wrote:
>>> That doesn't require existential quantification, but it'll need Rank-2 
>>> typesif you ever do anything with Job. Unfortunately, a universally 
>>> quantifiedJob like what you wrote (or what Magicloud seems to want) is only 
>>> inhabitedby the empty Map.
>>> >
>>> An existentially quantified Job, as you might get with
>>> >
>>> data Job = forall k a. Job (Map k a)
>>> >
>>> does let you wrap up any Map containing anything in it, but 
>>> unfortunatelythe only thing you can do with that map afterwards is ask for 
>>> "structural"properties about it, like whether it's empty or how many 
>>> elements it has init. You could ask to enumerate the elements in it, but 
>>> you wouldn't be ableto touch any of them because you wouldn't know what 
>>> their types were.
>>> >
>>> So I'm not really sure how to interpret the question. Was the goal to have 
>>> aheterogeneous Map, maybe? Or just to avoid having to type type variables 
>>> allover the place? Both of those are possible but require a bit 
>>> moresophistication with types.
>>> >
>>> -Dan
>>> >
>>> >
>>> On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa Palet>> (mailto:ifiguer...@gmail.com)> wrote:
>>> > >
>>> Do you want to hide the specific types of the job? Presumably to thendefine 
>>> a type JobList = [Job] ?You can do that with the ExistentialQuantification 
>>> extension.
>>> > >
>>> type Job = forall k a. Map k atype JobList = [Job]
>>> > >
>>> ??Note you can't unpack the types k a once you have hidden them. But 
>>> thetypechecker can use it to ensure some static property.Also you could use 
>>> unsafeCoerce to do some casts, but *only if you are*sure* that things will 
>>> go OK*.
>>> > >
>>> > >
>>> 2012/6/13 Magicloud Magiclouds >> (mailto:magicloud.magiclo...@gmail.com)>
>>> > > >
>>> Hi,I've forgotten this.This is OK:type Job k a = Map k aAnd this is OK:{-# 
>>> LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?type Job = forall a. 
>>> forall k. Map k a
>>> > > >
>>> Then how to write it like this?type Job = Map k a--竹密岂妨流水过山高哪阻野云飞
>>> > > >
>>> And for G+, please use magiclouds#gmail.com (http://gmail.com).
>>> > > >
>>> ___Haskell-Cafe mailing 
>>> listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org)
>>> > > > http://www.haskell.org/mailman/listinfo/haskell-cafe
>>> > >
>>> > >
>>> > >
>>> > >
>>> > >
>>> > >
>>> > >
>>> > >
>>> --Ismael
>>> > >
>>> > >
>>> ___Haskell-Cafe mailing 
>>> listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org)
>>> > > http://www.haskell.org/mailman/listinfo/haskell-cafe
>>> >
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> 竹密岂妨流水过
>>> 山高哪阻野云飞
>>>
>>> And for G+, please use magiclouds#gmail.com (http://gmail.com).
>>>
>>> 

Re: [Haskell-cafe] What extension do I need to write "type Job = Map k a"?

2012-06-13 Thread Magicloud Magiclouds
OK. I think I understand a little.
I use Job here just wants to simplify the code. And since I provide
the function as library, I cannot decide what exact type k is. What
should I do?

On Thu, Jun 14, 2012 at 11:23 AM, Arlen Cuss  wrote:
> (resending to café, turns out I wasn't subbed from this address.)
>
> Hi Magicloud,
> This is correct; because you've hidden the type-variables away by universally 
> quantifying them, there's no more level of specificity you can get back *out* 
> of them than just "some kind of Map" (Job = M.Map k b, where k ≠ k0, b ≠ b0).
>
> If you have a Job type which can store *any* kind of Map (forall k a. Job 
> (Map k a)), then that means you could have a Job with a Map Int Bool, and a 
> Job with a Map String (Float -> Float), and they'd both have the same type 
> "Job". You can't do anything with the values within, because you're being too 
> permissive about what a Job is.
>
> You may want "data Job k a = Job (Map k a)", *or* if you do actually use one 
> kind of Map only, then why not "data Job = Job (Map Int String)" 
> (substituting your real types for Int and String). In this case, you could 
> also consider using newtype ("newtype Job = Job { getJob :: Map Int String 
> }") to provide the guarantee that you're getting a Job (and not any Map Int 
> String) without performance loss.
>
> Let me know if I've been more confusing than helpful;
>
> Arlen
>
>
> On Thursday, 14 June 2012 at 1:16 PM, Magicloud Magiclouds wrote:
>
>> Hi there,
>> Thanks for the reply. To be clear, all I want is to "avoid having to
>> type type variables all over the place". What should I do? My original
>> code with RankNTypes and ImpredicativeTypes does not work
>>
>> The "type Job = forall k a. M.Map k a" works now. But function uses
>> it does not. Compiler complains about "Couldn't match expected type
>> `Job' with actual type `M.Map k0 b0'".
>>
>> On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles > (mailto:pumpkin...@gmail.com)> wrote:
>> That doesn't require existential quantification, but it'll need Rank-2 
>> typesif you ever do anything with Job. Unfortunately, a universally 
>> quantifiedJob like what you wrote (or what Magicloud seems to want) is only 
>> inhabitedby the empty Map.
>> >
>> An existentially quantified Job, as you might get with
>> >
>> data Job = forall k a. Job (Map k a)
>> >
>> does let you wrap up any Map containing anything in it, but unfortunatelythe 
>> only thing you can do with that map afterwards is ask for 
>> "structural"properties about it, like whether it's empty or how many 
>> elements it has init. You could ask to enumerate the elements in it, but you 
>> wouldn't be ableto touch any of them because you wouldn't know what their 
>> types were.
>> >
>> So I'm not really sure how to interpret the question. Was the goal to have 
>> aheterogeneous Map, maybe? Or just to avoid having to type type variables 
>> allover the place? Both of those are possible but require a bit 
>> moresophistication with types.
>> >
>> -Dan
>> >
>> >
>> On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa Palet> (mailto:ifiguer...@gmail.com)> wrote:
>> > >
>> Do you want to hide the specific types of the job? Presumably to thendefine 
>> a type JobList = [Job] ?You can do that with the ExistentialQuantification 
>> extension.
>> > >
>> type Job = forall k a. Map k atype JobList = [Job]
>> > >
>> ??Note you can't unpack the types k a once you have hidden them. But 
>> thetypechecker can use it to ensure some static property.Also you could use 
>> unsafeCoerce to do some casts, but *only if you are*sure* that things will 
>> go OK*.
>> > >
>> > >
>> 2012/6/13 Magicloud Magiclouds > (mailto:magicloud.magiclo...@gmail.com)>
>> > > >
>> Hi,I've forgotten this.This is OK:type Job k a = Map k aAnd this is OK:{-# 
>> LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?type Job = forall a. 
>> forall k. Map k a
>> > > >
>> Then how to write it like this?type Job = Map k a--竹密岂妨流水过山高哪阻野云飞
>> > > >
>> And for G+, please use magiclouds#gmail.com (http://gmail.com).
>> > > >
>> ___Haskell-Cafe mailing 
>> listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org)
>> > > > http://www.haskell.org/mailman/listinfo/haskell-cafe
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> --Ismael
>> > >
>> > >
>> ___Haskell-Cafe mailing 
>> listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org)
>> > > http://www.haskell.org/mailman/listinfo/haskell-cafe
>> >
>>
>>
>>
>>
>>
>>
>>
>> --
>> 竹密岂妨流水过
>> 山高哪阻野云飞
>>
>> And for G+, please use magiclouds#gmail.com (http://gmail.com).
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org (mailto:Haskell-Cafe@haskell.org)
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/

[Haskell-cafe] ANNOUNCE: uuid-1.2.6

2012-06-13 Thread Antoine Latter
Hi folks,

I'm happy to announce a new point release of the uuid library, 1.2.6:

http://hackage.haskell.org/package/uuid-1.2.6

The 'uuid' package implements most of RFC 4122[1] including random
generation and generation based on hardware MAC addresses.

I haven't announced a point-release in a while. The changes since 1.2.1 include:

* When generating UUIDs from the hardware MAC address, if the MAC
address is not available we now use a random seed for our (hidden,
global) state machine

* The 'Read' instance now drops leading spaces

* Added the functions 'toWords' and 'fromWords', primary to support
the package uuid-quasi[2].

Take care,
Antoine

1: http://tools.ietf.org/html/rfc4122
2: http://hackage.haskell.org/package/uuid-quasi

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


Re: [Haskell-cafe] What extension do I need to write "type Job = Map k a"?

2012-06-13 Thread Arlen Cuss
(resending to café, turns out I wasn't subbed from this address.)

Hi Magicloud,
This is correct; because you've hidden the type-variables away by universally 
quantifying them, there's no more level of specificity you can get back *out* 
of them than just "some kind of Map" (Job = M.Map k b, where k ≠ k0, b ≠ b0).

If you have a Job type which can store *any* kind of Map (forall k a. Job (Map 
k a)), then that means you could have a Job with a Map Int Bool, and a Job with 
a Map String (Float -> Float), and they'd both have the same type "Job". You 
can't do anything with the values within, because you're being too permissive 
about what a Job is.

You may want "data Job k a = Job (Map k a)", *or* if you do actually use one 
kind of Map only, then why not "data Job = Job (Map Int String)" (substituting 
your real types for Int and String). In this case, you could also consider 
using newtype ("newtype Job = Job { getJob :: Map Int String }") to provide the 
guarantee that you're getting a Job (and not any Map Int String) without 
performance loss.

Let me know if I've been more confusing than helpful;

Arlen


On Thursday, 14 June 2012 at 1:16 PM, Magicloud Magiclouds wrote:

> Hi there,
> Thanks for the reply. To be clear, all I want is to "avoid having to
> type type variables all over the place". What should I do? My original
> code with RankNTypes and ImpredicativeTypes does not work
>  
> The "type Job = forall k a. M.Map k a" works now. But function uses
> it does not. Compiler complains about "Couldn't match expected type
> `Job' with actual type `M.Map k0 b0'".
>  
> On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles  (mailto:pumpkin...@gmail.com)> wrote:
> That doesn't require existential quantification, but it'll need Rank-2 
> typesif you ever do anything with Job. Unfortunately, a universally 
> quantifiedJob like what you wrote (or what Magicloud seems to want) is only 
> inhabitedby the empty Map.
> >  
> An existentially quantified Job, as you might get with
> >  
> data Job = forall k a. Job (Map k a)
> >  
> does let you wrap up any Map containing anything in it, but unfortunatelythe 
> only thing you can do with that map afterwards is ask for 
> "structural"properties about it, like whether it's empty or how many elements 
> it has init. You could ask to enumerate the elements in it, but you wouldn't 
> be ableto touch any of them because you wouldn't know what their types were.
> >  
> So I'm not really sure how to interpret the question. Was the goal to have 
> aheterogeneous Map, maybe? Or just to avoid having to type type variables 
> allover the place? Both of those are possible but require a bit 
> moresophistication with types.
> >  
> -Dan
> >  
> >  
> On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa Palet (mailto:ifiguer...@gmail.com)> wrote:
> > >  
> Do you want to hide the specific types of the job? Presumably to thendefine a 
> type JobList = [Job] ?You can do that with the ExistentialQuantification 
> extension.
> > >  
> type Job = forall k a. Map k atype JobList = [Job]
> > >  
> ??Note you can't unpack the types k a once you have hidden them. But 
> thetypechecker can use it to ensure some static property.Also you could use 
> unsafeCoerce to do some casts, but *only if you are*sure* that things will go 
> OK*.
> > >  
> > >  
> 2012/6/13 Magicloud Magiclouds  (mailto:magicloud.magiclo...@gmail.com)>
> > > >  
> Hi,I've forgotten this.This is OK:type Job k a = Map k aAnd this is OK:{-# 
> LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?type Job = forall a. forall 
> k. Map k a
> > > >  
> Then how to write it like this?type Job = Map k a--竹密岂妨流水过山高哪阻野云飞
> > > >  
> And for G+, please use magiclouds#gmail.com (http://gmail.com).
> > > >  
> ___Haskell-Cafe mailing 
> listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org)
> > > > http://www.haskell.org/mailman/listinfo/haskell-cafe
> > >  
> > >  
> > >  
> > >  
> > >  
> > >  
> > >  
> > >  
> --Ismael
> > >  
> > >  
> ___Haskell-Cafe mailing 
> listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org)
> > > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >  
>  
>  
>  
>  
>  
>  
>  
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>  
> And for G+, please use magiclouds#gmail.com (http://gmail.com).
>  
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org (mailto:Haskell-Cafe@haskell.org)
> http://www.haskell.org/mailman/listinfo/haskell-cafe  



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


Re: [Haskell-cafe] What extension do I need to write "type Job = Map k a"?

2012-06-13 Thread Magicloud Magiclouds
Hi there,
  Thanks for the reply. To be clear, all I want is to "avoid having to
type type variables all over the place". What should I do? My original
code with RankNTypes and ImpredicativeTypes does not work

  The "type Job = forall k a. M.Map k a" works now. But function uses
it does not. Compiler complains about "Couldn't match expected type
`Job' with actual type `M.Map k0 b0'".

On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles  wrote:
> That doesn't require existential quantification, but it'll need Rank-2 types
> if you ever do anything with Job. Unfortunately, a universally quantified
> Job like what you wrote (or what Magicloud seems to want) is only inhabited
> by the empty Map.
>
> An existentially quantified Job, as you might get with
>
> data Job = forall k a. Job (Map k a)
>
> does let you wrap up any Map containing anything in it, but unfortunately
> the only thing you can do with that map afterwards is ask for "structural"
> properties about it, like whether it's empty or how many elements it has in
> it. You could ask to enumerate the elements in it, but you wouldn't be able
> to touch any of them because you wouldn't know what their types were.
>
> So I'm not really sure how to interpret the question. Was the goal to have a
> heterogeneous Map, maybe? Or just to avoid having to type type variables all
> over the place? Both of those are possible but require a bit more
> sophistication with types.
>
> -Dan
>
>
> On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa Palet
>  wrote:
>>
>> Do you want to hide the specific types of the job? Presumably to then
>> define a type JobList = [Job] ?
>> You can do that with the ExistentialQuantification extension.
>>
>> type Job = forall k a. Map k a
>> type JobList = [Job]
>>
>> ??
>> Note you can't unpack the types k a once you have hidden them. But the
>> typechecker can use it to ensure some static property.
>> Also you could use unsafeCoerce to do some casts, but *only if you are
>> *sure* that things will go OK*.
>>
>>
>> 2012/6/13 Magicloud Magiclouds 
>>>
>>> Hi,
>>>  I've forgotten this.
>>>  This is OK:
>>> type Job k a = Map k a
>>>  And this is OK:
>>> {-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?
>>> type Job = forall a. forall k. Map k a
>>>
>>>  Then how to write it like this?
>>> type Job = Map k a
>>> --
>>> 竹密岂妨流水过
>>> 山高哪阻野云飞
>>>
>>> And for G+, please use magiclouds#gmail.com.
>>>
>>> ___
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe@haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>>
>>
>> --
>> Ismael
>>
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>



-- 
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

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


[Haskell-cafe] Haskell Weekly News: Issue 231

2012-06-13 Thread Daniel Santa Cruz
Welcome to issue 231 of the HWN, an issue covering crowd-sourced bits
of information about Haskell from around the web. This issue covers
the week of June 03 to 09, 2012.

Announcements

Paolo Capriotti announced the patchlevel release of GHC 7.4.2. "This
release contains a number of bugfixes relative to 7.4.1, so we
recommend upgrading."
[1] http://goo.gl/X3Z85

Quotes of the Week

   * roconnor: there's a right way, and a wrong way, and then there is
   the ekmett way.

Top Reddit Stories

   * Haskell Platform 2012.2.0.0 released
 Domain: hackage.haskell.org, Score: 104, Comments: 33
 On Reddit: [2] http://goo.gl/ZNa9h
 Original: [3] http://goo.gl/JjJg2

   * Why free monads matter
 Domain: haskellforall.com, Score: 61, Comments: 47
 On Reddit: [4] http://goo.gl/hfKlc
 Original: [5] http://goo.gl/JPpsp

   * 3 Flavors of MVar: Lock, Var, Barrier
 Domain: neilmitchell.blogspot.com, Score: 43, Comments: 20
 On Reddit: [6] http://goo.gl/3eEkO
 Original: [7] http://goo.gl/ek7Qq

   * Introducing the HERMIT Equational Reasoning Framework
 Domain: ittc.ku.edu, Score: 36, Comments: 20
 On Reddit: [8] http://goo.gl/UC0sF
 Original: [9] http://goo.gl/ifS7f

   * Complicating conduit?
 Domain: yesodweb.com, Score: 35, Comments: 45
 On Reddit: [10] http://goo.gl/W4rfE
 Original: [11] http://goo.gl/rU0vK

   * Beautiful Code, Compelling Evidence: OpenGL, Cairo tutorial
 [PDF, 33 pages]
 Domain: renci.org, Score: 33, Comments: 2
 On Reddit: [12] http://goo.gl/qKY8w
 Original: [13] http://goo.gl/r5SVj

   * Forklift - a pattern for performing monadic actions in a worker thread
 Domain: apfelmus.nfshost.com, Score: 30, Comments: 7
 On Reddit: [14] http://goo.gl/B6brV
 Original: [15] http://goo.gl/mWVAv

   * Dependently typed programming with singletons (Eisenberg, Weirich)[PDF]
 Domain: cis.upenn.edu, Score: 29, Comments: 3
 On Reddit: [16] http://goo.gl/y3fYv
 Original: [17] http://goo.gl/RqM5m

   * Continuation-based relative-time FRP
 Domain: paolocapriotti.com, Score: 22, Comments: 6
 On Reddit: [18] http://goo.gl/CFSK7
 Original: [19] http://goo.gl/cP0cJ

   * Explaining the Prompt monad with a clearer representation
 Domain: joeysmandatory.blogspot.com, Score: 21, Comments: 42
 On Reddit: [20] http://goo.gl/ZZM93
 Original: [21] http://goo.gl/Im7SF

   * Lazily Evaluate length of a list
 Domain: self.haskell, Score: 21, Comments: 29
 On Reddit: [22] http://goo.gl/cKUOt
 Original: [23] http://goo.gl/cKUOt

Top StackOverflow Questions

   * Killing a thread when MVar is garbage collected
 votes: 22, answers: 4
 Read on SO: [24] http://goo.gl/cvoqw

   * How does one write efficient Dynamic Programming algorithms in Haskell?
 votes: 16, answers: 3
 Read on SO: [25] http://goo.gl/mkMTp

   * How to apply a polymorphic function to a Dynamic value
 votes: 11, answers: 1
 Read on SO: [26] http://goo.gl/3jIVr

   * Haskell Typeclass for Tuples
 votes: 11, answers: 3
 Read on SO: [27] http://goo.gl/pvDah

   * Monadic expressions in conditionals - GHC compiles, cabal refuses
 votes: 10, answers: 2
 Read on SO: [28] http://goo.gl/QXMXh

   * GHC Optimization: Collatz conjecture
 votes: 10, answers: 2
 Read on SO: [29] http://goo.gl/AfiEC

   * Haskell: Lists vs Streams
 votes: 10, answers: 3
 Read on SO: [30] http://goo.gl/qn1dE

   * Is my program Turing-complete?
 votes: 9, answers: 2
 Read on SO: [31] http://goo.gl/PLf5q

   * How to find the optimal processing order?
 votes: 9, answers: 1
 Read on SO: [32] http://goo.gl/P3XZ2

   * How to do fast data deserialization in Haskell
 votes: 9, answers: 1
 Read on SO: [33] http://goo.gl/Synm2

   * What's so bad about OverlappingInstances?
 votes: 9, answers: 1
 Read on SO: [34] http://goo.gl/M17Rp


Until next time,
Daniel Santa Cruz

References

   1. http://permalink.gmane.org/gmane.comp.lang.haskell.glasgow.user/22181
   2. http://hackage.haskell.org/platform/?2012.2.0.0
   3. 
http://www.reddit.com/r/haskell/comments/uipvz/haskell_platform_2012200_released/
   4. 
http://www.haskellforall.com/2012/06/you-could-have-invented-free-monads.html
   5. http://www.reddit.com/r/haskell/comments/utxq2/why_free_monads_matter/
   6. http://neilmitchell.blogspot.com/2012/06/flavours-of-mvar_04.html
   7. 
http://www.reddit.com/r/haskell/comments/uk9wu/3_flavors_of_mvar_lock_var_barrier/
   8. http://www.ittc.ku.edu/csdlblog/?p=105
   9. 
http://www.reddit.com/r/haskell/comments/ujdet/introducing_the_hermit_equational_reasoning/
  10. http://www.yesodweb.com/blog/2012/06/complicating-conduit
  11. http://www.reddit.com/r/haskell/comments/urc75/complicating_conduit/
  12. http://www.renci.org/wp-content/pub/tutorials/BeautifulCode.pdf
  13. 
http://www.reddit.com/r/haskell/comments/uqc33/beautiful_code_compelling_evidence_opengl_cairo/
  14. http://

Re: [Haskell-cafe] What extension do I need to write "type Job = Map k a"?

2012-06-13 Thread Magicloud Magiclouds
Thank you all. I just want to wrap some complex types.
So I learn from all info above, I still have to use forall explicitly

On Wed, Jun 13, 2012 at 9:19 PM, Yves Parès  wrote:
> Mmmmh... no, to do that you need ImpredicativeTypes (which is I believe
> about to be deprecated).
> You have to declare Job a data, not a type, and use
> ExistentialQuantification.
>
>
> 2012/6/13 Ismael Figueroa Palet 
>>
>> Do you want to hide the specific types of the job? Presumably to then
>> define a type JobList = [Job] ?
>> You can do that with the ExistentialQuantification extension.
>>
>> type Job = forall k a. Map k a
>> type JobList = [Job]
>>
>> ??
>> Note you can't unpack the types k a once you have hidden them. But the
>> typechecker can use it to ensure some static property.
>> Also you could use unsafeCoerce to do some casts, but *only if you are
>> *sure* that things will go OK*.
>>
>>
>> 2012/6/13 Magicloud Magiclouds 
>>>
>>> Hi,
>>>  I've forgotten this.
>>>  This is OK:
>>> type Job k a = Map k a
>>>  And this is OK:
>>> {-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?
>>> type Job = forall a. forall k. Map k a
>>>
>>>  Then how to write it like this?
>>> type Job = Map k a
>>> --
>>> 竹密岂妨流水过
>>> 山高哪阻野云飞
>>>
>>> And for G+, please use magiclouds#gmail.com.
>>>
>>> ___
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe@haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>>
>>
>> --
>> Ismael
>>
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>



-- 
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

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


Re: [Haskell-cafe] Current uses of Haskell in industry?

2012-06-13 Thread Christopher Done
On 14 June 2012 02:00, Chris Smith  wrote:
> It turns out I'm filling in for a cancelled speaker at a local open
> source user group, and doing a two-part talk, first on Haskell and
> then Snap.  For the Haskell part, I'd like a list of current places
> the language is used in industry.  I recall a few from Reddit stories
> and messages here and other sources, but I wonder if anyone is keeping
> a list.

The wiki goes without saying I suppose:
http://www.haskell.org/haskellwiki/Haskell_in_industry

We use it for web dev here at CREATE-NET. Two public facing sites:

http://confy.eai.eu/ -- For paper submission/review (like EasyChair).
About 17K lines of Haskell, 20K of JS (actually some pages are Haskell
compiled to JavaScript with my compiler). Couple hundred lines of
Java. It was supposed to be released open source last year but you
know what corporations are like.

http://eudl.eu/content -- A digital archive, like IEEEXplore or ACM
digital library. Not so big, about 11K lines of Haskell.

Both have lots of internal-only features, IEEE/ACM/Springer
communication stuff. Maybe I should add to the wiki list.

Ciao!

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


[Haskell-cafe] Current uses of Haskell in industry?

2012-06-13 Thread Chris Smith
It turns out I'm filling in for a cancelled speaker at a local open
source user group, and doing a two-part talk, first on Haskell and
then Snap.  For the Haskell part, I'd like a list of current places
the language is used in industry.  I recall a few from Reddit stories
and messages here and other sources, but I wonder if anyone is keeping
a list.

-- 
Chris

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


Re: [Haskell-cafe] Perth Functional Programmers meetup group launched

2012-06-13 Thread Tony Morris
Hi Todd,
I am over the other side. I help organise the Brisbane Functional
Programming Group.
http://bfpg.org/

Although we discuss FP in general, we have a pretty strong emphasis on
Haskell. Let me know how it goes or if we can help out in any way!


On 14/06/12 00:46, Todd Owen wrote:
> We are pleased to announce that a functional programming user group has
> recently been formed in Perth, Australia.
>
> Being a small community, we aim to keep the group as inclusive as possible,
> and welcome new members from all levels of experience and language
> backgrounds. (That said, Haskellers currently account for about half our
> membership, followed by F#, and then a heap of other languages).
>
> As this is a global mailing list, I would also like to invite our
> colleagues from around Australia, and indeed anywhere in the world, to get
> in touch if you are ever passing through Perth. We're always happy to share
> a beer and talk about programming!
>
> For more information, visit: http://www.meetup.com/PerthFP/
>
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


-- 
Tony Morris
http://tmorris.net/


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


[Haskell-cafe] Perth Functional Programmers meetup group launched

2012-06-13 Thread Todd Owen
We are pleased to announce that a functional programming user group has
recently been formed in Perth, Australia.

Being a small community, we aim to keep the group as inclusive as possible,
and welcome new members from all levels of experience and language
backgrounds. (That said, Haskellers currently account for about half our
membership, followed by F#, and then a heap of other languages).

As this is a global mailing list, I would also like to invite our
colleagues from around Australia, and indeed anywhere in the world, to get
in touch if you are ever passing through Perth. We're always happy to share
a beer and talk about programming!

For more information, visit: http://www.meetup.com/PerthFP/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Warning when attempting to install cabal-dev on the latest HP

2012-06-13 Thread Edward Amsden
For reference to anyone coming across this:

The issue is that cabal-dev does in fact depend on the old mtl, if one checks
the cabal file. (Thanks to dcoutts_ on #haskell).

The suggestion I received was to use virthualenv.

On Wed, Jun 13, 2012 at 9:20 AM, Edward Amsden  wrote:
> http://hpaste.org/69885
>
> The warning in that paste occurs when I attempt
> $ cabal update
> $ cabal install cabal-dev
>
> This is curious because it wants to install a previous version of mtl.
> I can't figure out why. There doesn't seem to be any dependency
> between cabal-dev and mtl. According to hackage, the dependencies for
> cabal-dev are:
>
>
> cabal-dev -> (base, Cabal)
> Cabal -> (base, filepath)
> filepath -> (base)
> base -> ()
>
> The dependencies for mtl are (just to show no conflicts)
> mtl -> (base, transformers)
> transformers -> (base)
> base -> ()
>
> And there's not a versioning conflict with base.
>
> Why is cabal insisting on backdating mtl then?



-- 
Edward Amsden
Student
Computer Science
Rochester Institute of Technology
www.edwardamsden.com

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


[Haskell-cafe] Warning when attempting to install cabal-dev on the latest HP

2012-06-13 Thread Edward Amsden
http://hpaste.org/69885

The warning in that paste occurs when I attempt
$ cabal update
$ cabal install cabal-dev

This is curious because it wants to install a previous version of mtl.
I can't figure out why. There doesn't seem to be any dependency
between cabal-dev and mtl. According to hackage, the dependencies for
cabal-dev are:


cabal-dev -> (base, Cabal)
Cabal -> (base, filepath)
filepath -> (base)
base -> ()

The dependencies for mtl are (just to show no conflicts)
mtl -> (base, transformers)
transformers -> (base)
base -> ()

And there's not a versioning conflict with base.

Why is cabal insisting on backdating mtl then?

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


Re: [Haskell-cafe] What extension do I need to write "type Job = Map k a"?

2012-06-13 Thread Yves Parès
Mmmmh... no, to do that you need ImpredicativeTypes (which is I believe
about to be deprecated).
You have to declare Job a data, not a type, and use
ExistentialQuantification.

2012/6/13 Ismael Figueroa Palet 

> Do you want to hide the specific types of the job? Presumably to then
> define a type JobList = [Job] ?
> You can do that with the ExistentialQuantification extension.
>
> type Job = forall k a. Map k a
> type JobList = [Job]
>
> ??
> Note you can't unpack the types k a once you have hidden them. But the
> typechecker can use it to ensure some static property.
> Also you could use unsafeCoerce to do some casts, but *only if you are
> *sure* that things will go OK*.
>
>
> 2012/6/13 Magicloud Magiclouds 
>
>> Hi,
>>  I've forgotten this.
>>  This is OK:
>> type Job k a = Map k a
>>  And this is OK:
>> {-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?
>> type Job = forall a. forall k. Map k a
>>
>>  Then how to write it like this?
>> type Job = Map k a
>> --
>> 竹密岂妨流水过
>> 山高哪阻野云飞
>>
>> And for G+, please use magiclouds#gmail.com.
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
>
> --
> Ismael
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What extension do I need to write "type Job = Map k a"?

2012-06-13 Thread Daniel Peebles
That doesn't require existential quantification, but it'll need Rank-2
types if you ever do anything with Job. Unfortunately, a universally
quantified Job like what you wrote (or what Magicloud seems to want) is
only inhabited by the empty Map.

An existentially quantified Job, as you might get with

data Job = forall k a. Job (Map k a)

does let you wrap up any Map containing anything in it, but unfortunately
the only thing you can do with that map afterwards is ask for "structural"
properties about it, like whether it's empty or how many elements it has in
it. You could ask to enumerate the elements in it, but you wouldn't be able
to touch any of them because you wouldn't know what their types were.

So I'm not really sure how to interpret the question. Was the goal to have
a heterogeneous Map, maybe? Or just to avoid having to type type variables
all over the place? Both of those are possible but require a bit more
sophistication with types.

-Dan

On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa Palet  wrote:

> Do you want to hide the specific types of the job? Presumably to then
> define a type JobList = [Job] ?
> You can do that with the ExistentialQuantification extension.
>
> type Job = forall k a. Map k a
> type JobList = [Job]
>
> ??
> Note you can't unpack the types k a once you have hidden them. But the
> typechecker can use it to ensure some static property.
> Also you could use unsafeCoerce to do some casts, but *only if you are
> *sure* that things will go OK*.
>
>
> 2012/6/13 Magicloud Magiclouds 
>
>> Hi,
>>  I've forgotten this.
>>  This is OK:
>> type Job k a = Map k a
>>  And this is OK:
>> {-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?
>> type Job = forall a. forall k. Map k a
>>
>>  Then how to write it like this?
>> type Job = Map k a
>> --
>> 竹密岂妨流水过
>> 山高哪阻野云飞
>>
>> And for G+, please use magiclouds#gmail.com.
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
>
> --
> Ismael
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What extension do I need to write "type Job = Map k a"?

2012-06-13 Thread Ismael Figueroa Palet
Do you want to hide the specific types of the job? Presumably to then
define a type JobList = [Job] ?
You can do that with the ExistentialQuantification extension.

type Job = forall k a. Map k a
type JobList = [Job]

??
Note you can't unpack the types k a once you have hidden them. But the
typechecker can use it to ensure some static property.
Also you could use unsafeCoerce to do some casts, but *only if you are
*sure* that things will go OK*.


2012/6/13 Magicloud Magiclouds 

> Hi,
>  I've forgotten this.
>  This is OK:
> type Job k a = Map k a
>  And this is OK:
> {-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?
> type Job = forall a. forall k. Map k a
>
>  Then how to write it like this?
> type Job = Map k a
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>
> And for G+, please use magiclouds#gmail.com.
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Ismael
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What extension do I need to write "type Job = Map k a"?

2012-06-13 Thread Ivan Lazar Miljenovic
On 13 June 2012 19:59, Magicloud Magiclouds
 wrote:
> Hi,
>  I've forgotten this.
>  This is OK:
> type Job k a = Map k a
>  And this is OK:
> {-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?
> type Job = forall a. forall k. Map k a
>
>  Then how to write it like this?
> type Job = Map k a

Does that even make sense?  What are the types of `k' and `a' in Job?

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
http://IvanMiljenovic.wordpress.com

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


[Haskell-cafe] What extension do I need to write "type Job = Map k a"?

2012-06-13 Thread Magicloud Magiclouds
Hi,
  I've forgotten this.
  This is OK:
type Job k a = Map k a
  And this is OK:
{-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms?
type Job = forall a. forall k. Map k a

  Then how to write it like this?
type Job = Map k a
-- 
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

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


Re: [Haskell-cafe] Performance with do notation, mwc-random and unboxed vector

2012-06-13 Thread Roman Leshchinskiy
On 12 Jun 2012, at 12:52, Dmitry Dzhus  wrote:

> 12.06.2012, 01:08, "Roman Leshchinskiy" :
> 
>> perhaps the state hack is getting in the way.
> 
> I don't quite understand the internals of this yet, but `-fno-state-hack` 
> leads to great performance in both cases!
> How safe is that?

It doesn't change the semantics of your program but it can make it 
significantly slower (or faster, as in this case). The various state hack 
related tickets on trac might give you an idea of what is happening here.

We really need some proper arity analysis!

Roman



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


[Haskell-cafe] RawFilePath vs System.FilePath

2012-06-13 Thread 山本和彦
Hello,

After releaseing new Haskell Platform, many people can now use
RawFilePath (e.g. ByteString) for System.*. However, there is no
System.FilePath.ByteString which manipulates RawFilePath.

How do you guys manipulate RawFilePath as file path?
Is there a plan to implement System.FilePath.ByteString?

# I know the system-filepath package. But I would like to know
# answers to the questions above.

Regards,

--Kazu

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