Re: [haskell art] [Haskell-cafe] the library of beautiful instruments implemented in haskell / csound

2015-09-14 Thread amindfv
Oh interesting! I had thought CSound didn't do realtime synthesis.

tom


El Sep 14, 2015, a las 6:15, Anton Kholomiov <anton.kholom...@gmail.com> 
escribió:

> It's all was played live with Csound triggered by midi keyboard and recorded 
> with Audacity (connected to csound output with Jack)
> 
> 2015-09-14 13:11 GMT+03:00 Anton Kholomiov <anton.kholom...@gmail.com>:
>> Thanks for feedback. I've used several sources on sound design:
>> 
>> Ian McCurdy collection of csound instruments: 
>> http://iainmccurdy.org/csound.html
>> 
>> Thor demystified series by Gordon Reid: 
>> https://www.propellerheads.se/substance/discovering-reason/index.cfm?article=part19=get_article
>> 
>> Csound pieces from Csound Catalog: http://www.csounds.com/csound-catalog/
>> 
>> Olav Basoski course: https://www.macprovideo.com/tutorial/live8402
>> 
>> Sound on sound synth secrets: 
>> http://www.soundonsound.com/sos/allsynthsecrets.htm
>> 
>> Risset' Amsterdam Collection of Csound Instruments: 
>> http://www.codemist.co.uk/AmsterdamCatalog/
>> 
>> It's mostly Iain McCurdy instruments, thor demystified series, and 
>> instruments from various pieces 
>> by Csounders (Csound catalog)
>> 
>> 
>> 
>> 
>> 2015-09-14 0:38 GMT+03:00 Tom Murphy <amin...@gmail.com>:
>>> These sound great, congratulations! "Batteries included" is a great place 
>>> to be. Can you point to references you used to create the instrument 
>>> definitions?
>>> 
>>> Tom
>>> 
>>> 
>>> On Sun, Sep 13, 2015 at 9:13 AM, Anton Kholomiov 
>>> <anton.kholom...@gmail.com> wrote:
>>>> Status update for my haskell synth csound-expression. The main point is 
>>>> presence of many cool instruments. They are implemented in the package 
>>>> csound-catalog. All packages are compiled with GHC-7.10 So the hackage 
>>>> fails to build them and unfortunately docs a broken too. But you can look 
>>>> at the source code of the module Csound.Patch to now  the names of the 
>>>> instruments. The usage is pretty straightforward. It's described here:
>>>> 
>>>> https://github.com/spell-music/csound-expression/blob/master/tutorial/chapters/Patches.md
>>>> 
>>>> There is an mp3 file to listen to the instruments. 
>>>> http://ge.tt/1jNETqN2/v/0
>>>> 
>>>> The 4.8.3 is out! New features:
>>>> 
>>>> This is a very important release to me. It tries to solve the problem 
>>>> present in the most open source music-production libraries. It's often the 
>>>> pack of beautiful sounds/timbres is missing. User is presented with many 
>>>> audio primitives but no timbres are present to show the real power of the 
>>>> framework. This release solves this problem. See the friend package 
>>>> csound-catalog on Hackage. It defines 200+ beautiful instruments ready to 
>>>> be used.
>>>> 
>>>> The csound-expression defines a new type called Patch for description of 
>>>> an instrument with a chain of effects. It's good place to start the 
>>>> journey to the world of music production.
>>>> 
>>>> There are new functions for synchronized reaction on events. The 
>>>> triggering of events can be synchronized with given BPM.
>>>> 
>>>> The library is updated for GHC-7.10!
>>>> 
>>>> 
>>>> 
>>>> github repo: https://github.com/spell-music/csound-expression
>>>> 
>>>> hackage: http://hackage.haskell.org/package/csound-expression
>>>> 
>>>> 
>>>> 
>>>> Cheers!
>>>> 
>>>> 
>>>> ___
>>>> Haskell-Cafe mailing list
>>>> Haskell-Cafe@haskell.org
>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> 

-- 

Read the whole topic here: Haskell Art:
http://lurk.org/r/topic/61ZKzObYdNnkFAsQBsowyU

To leave Haskell Art, email haskell-...@group.lurk.org with the following email 
subject: unsubscribe


Re: [haskell art] [Haskell-cafe] the library of beautiful instruments implemented in haskell / csound

2015-09-14 Thread Anton Kholomiov
Yes, it can work in real time! There is even an Android app that uses
Csound in real-time. It's called EtherPad. And a couple of iOS  apps:
csGrain and csSpectral

http://www.youtube.com/watch?v=SZ7Tbc8dIsg
http://www.boulangerlabs.com/

Though some instruments require  lots of CPU.
With Jack I was able to stream the audio to DAW live.

2015-09-14 17:31 GMT+03:00 <amin...@gmail.com>:

> Oh interesting! I had thought CSound didn't do realtime synthesis.
>
> tom
>
>
> El Sep 14, 2015, a las 6:15, Anton Kholomiov <anton.kholom...@gmail.com>
> escribió:
>
> It's all was played live with Csound triggered by midi keyboard and
> recorded with Audacity (connected to csound output with Jack)
>
> 2015-09-14 13:11 GMT+03:00 Anton Kholomiov <anton.kholom...@gmail.com>:
>
>> Thanks for feedback. I've used several sources on sound design:
>>
>> Ian McCurdy collection of csound instruments:
>> http://iainmccurdy.org/csound.html
>>
>> Thor demystified series by Gordon Reid:
>> https://www.propellerheads.se/substance/discovering-reason/index.cfm?article=part19=get_article
>>
>> Csound pieces from Csound Catalog: http://www.csounds.com/csound-catalog/
>>
>> Olav Basoski course: https://www.macprovideo.com/tutorial/live8402
>>
>> Sound on sound synth secrets:
>> http://www.soundonsound.com/sos/allsynthsecrets.htm
>>
>> Risset' Amsterdam Collection of Csound Instruments:
>> http://www.codemist.co.uk/AmsterdamCatalog/
>>
>> It's mostly Iain McCurdy instruments, thor demystified series, and
>> instruments from various pieces
>> by Csounders (Csound catalog)
>>
>>
>>
>>
>> 2015-09-14 0:38 GMT+03:00 Tom Murphy <amin...@gmail.com>:
>>
>>> These sound great, congratulations! "Batteries included" is a great
>>> place to be. Can you point to references you used to create the instrument
>>> definitions?
>>>
>>> Tom
>>>
>>>
>>> On Sun, Sep 13, 2015 at 9:13 AM, Anton Kholomiov <
>>> anton.kholom...@gmail.com> wrote:
>>>
>>>> Status update for my haskell synth csound-expression. The main point is
>>>> presence of many cool instruments. They are implemented in the package
>>>> csound-catalog. All packages are compiled with GHC-7.10 So the hackage
>>>> fails to build them and unfortunately docs a broken too. But you can look
>>>> at the source code of the module Csound.Patch to now  the names of the
>>>> instruments. The usage is pretty straightforward. It's described here:
>>>>
>>>>
>>>> https://github.com/spell-music/csound-expression/blob/master/tutorial/chapters/Patches.md
>>>>
>>>> There is an mp3 file to listen to the instruments.
>>>> http://ge.tt/1jNETqN2/v/0
>>>>
>>>> *The 4.8.3 is out! New features:*
>>>>
>>>> This is a very important release to me. It tries to solve the problem
>>>> present in the most open source music-production libraries. It's often the
>>>> pack of beautiful sounds/timbres is missing. User is presented with many
>>>> audio primitives but no timbres are present to show the real power of the
>>>> framework. This release solves this problem. See the friend package
>>>> csound-catalog on Hackage. It defines 200+ beautiful instruments ready to
>>>> be used.
>>>>
>>>> The csound-expression defines a new type called Patch for description
>>>> of an instrument with a chain of effects. It's good place to start the
>>>> journey to the world of music production.
>>>>
>>>> There are new functions for synchronized reaction on events. The
>>>> triggering of events can be synchronized with given BPM.
>>>>
>>>> The library is updated for GHC-7.10!
>>>>
>>>>
>>>> github repo: https://github.com/spell-music/csound-expression
>>>>
>>>> hackage: http://hackage.haskell.org/package/csound-expression
>>>>
>>>>
>>>> Cheers!
>>>>
>>>> ___
>>>> Haskell-Cafe mailing list
>>>> Haskell-Cafe@haskell.org
>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>>>
>>>>
>>>
>>
>

-- 

Read the whole topic here: Haskell Art:
http://lurk.org/r/topic/7dLZgeJosMNt4PUwHrzUbV

To leave Haskell Art, email haskell-...@group.lurk.org with the following email 
subject: unsubscribe


Re: [haskell art] [Haskell-cafe] the library of beautiful instruments implemented in haskell / csound

2015-09-14 Thread Anton Kholomiov
Thanks for feedback. I've used several sources on sound design:

Ian McCurdy collection of csound instruments:
http://iainmccurdy.org/csound.html

Thor demystified series by Gordon Reid:
https://www.propellerheads.se/substance/discovering-reason/index.cfm?article=part19=get_article

Csound pieces from Csound Catalog: http://www.csounds.com/csound-catalog/

Olav Basoski course: https://www.macprovideo.com/tutorial/live8402

Sound on sound synth secrets:
http://www.soundonsound.com/sos/allsynthsecrets.htm

Risset' Amsterdam Collection of Csound Instruments:
http://www.codemist.co.uk/AmsterdamCatalog/

It's mostly Iain McCurdy instruments, thor demystified series, and
instruments from various pieces
by Csounders (Csound catalog)




2015-09-14 0:38 GMT+03:00 Tom Murphy <amin...@gmail.com>:

> These sound great, congratulations! "Batteries included" is a great place
> to be. Can you point to references you used to create the instrument
> definitions?
>
> Tom
>
>
> On Sun, Sep 13, 2015 at 9:13 AM, Anton Kholomiov <
> anton.kholom...@gmail.com> wrote:
>
>> Status update for my haskell synth csound-expression. The main point is
>> presence of many cool instruments. They are implemented in the package
>> csound-catalog. All packages are compiled with GHC-7.10 So the hackage
>> fails to build them and unfortunately docs a broken too. But you can look
>> at the source code of the module Csound.Patch to now  the names of the
>> instruments. The usage is pretty straightforward. It's described here:
>>
>>
>> https://github.com/spell-music/csound-expression/blob/master/tutorial/chapters/Patches.md
>>
>> There is an mp3 file to listen to the instruments.
>> http://ge.tt/1jNETqN2/v/0
>>
>> *The 4.8.3 is out! New features:*
>>
>> This is a very important release to me. It tries to solve the problem
>> present in the most open source music-production libraries. It's often the
>> pack of beautiful sounds/timbres is missing. User is presented with many
>> audio primitives but no timbres are present to show the real power of the
>> framework. This release solves this problem. See the friend package
>> csound-catalog on Hackage. It defines 200+ beautiful instruments ready to
>> be used.
>>
>> The csound-expression defines a new type called Patch for description of
>> an instrument with a chain of effects. It's good place to start the journey
>> to the world of music production.
>>
>> There are new functions for synchronized reaction on events. The
>> triggering of events can be synchronized with given BPM.
>>
>> The library is updated for GHC-7.10!
>>
>>
>> github repo: https://github.com/spell-music/csound-expression
>>
>> hackage: http://hackage.haskell.org/package/csound-expression
>>
>>
>> Cheers!
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>
>>
>

-- 

Read the whole topic here: Haskell Art:
http://lurk.org/r/topic/1SpTk8oWlM2aVOflz0wecg

To leave Haskell Art, email haskell-...@group.lurk.org with the following email 
subject: unsubscribe


Re: [haskell art] [Haskell-cafe] the library of beautiful instruments implemented in haskell / csound

2015-09-14 Thread Anton Kholomiov
It's all was played live with Csound triggered by midi keyboard and
recorded with Audacity (connected to csound output with Jack)

2015-09-14 13:11 GMT+03:00 Anton Kholomiov <anton.kholom...@gmail.com>:

> Thanks for feedback. I've used several sources on sound design:
>
> Ian McCurdy collection of csound instruments:
> http://iainmccurdy.org/csound.html
>
> Thor demystified series by Gordon Reid:
> https://www.propellerheads.se/substance/discovering-reason/index.cfm?article=part19=get_article
>
> Csound pieces from Csound Catalog: http://www.csounds.com/csound-catalog/
>
> Olav Basoski course: https://www.macprovideo.com/tutorial/live8402
>
> Sound on sound synth secrets:
> http://www.soundonsound.com/sos/allsynthsecrets.htm
>
> Risset' Amsterdam Collection of Csound Instruments:
> http://www.codemist.co.uk/AmsterdamCatalog/
>
> It's mostly Iain McCurdy instruments, thor demystified series, and
> instruments from various pieces
> by Csounders (Csound catalog)
>
>
>
>
> 2015-09-14 0:38 GMT+03:00 Tom Murphy <amin...@gmail.com>:
>
>> These sound great, congratulations! "Batteries included" is a great place
>> to be. Can you point to references you used to create the instrument
>> definitions?
>>
>> Tom
>>
>>
>> On Sun, Sep 13, 2015 at 9:13 AM, Anton Kholomiov <
>> anton.kholom...@gmail.com> wrote:
>>
>>> Status update for my haskell synth csound-expression. The main point is
>>> presence of many cool instruments. They are implemented in the package
>>> csound-catalog. All packages are compiled with GHC-7.10 So the hackage
>>> fails to build them and unfortunately docs a broken too. But you can look
>>> at the source code of the module Csound.Patch to now  the names of the
>>> instruments. The usage is pretty straightforward. It's described here:
>>>
>>>
>>> https://github.com/spell-music/csound-expression/blob/master/tutorial/chapters/Patches.md
>>>
>>> There is an mp3 file to listen to the instruments.
>>> http://ge.tt/1jNETqN2/v/0
>>>
>>> *The 4.8.3 is out! New features:*
>>>
>>> This is a very important release to me. It tries to solve the problem
>>> present in the most open source music-production libraries. It's often the
>>> pack of beautiful sounds/timbres is missing. User is presented with many
>>> audio primitives but no timbres are present to show the real power of the
>>> framework. This release solves this problem. See the friend package
>>> csound-catalog on Hackage. It defines 200+ beautiful instruments ready to
>>> be used.
>>>
>>> The csound-expression defines a new type called Patch for description
>>> of an instrument with a chain of effects. It's good place to start the
>>> journey to the world of music production.
>>>
>>> There are new functions for synchronized reaction on events. The
>>> triggering of events can be synchronized with given BPM.
>>>
>>> The library is updated for GHC-7.10!
>>>
>>>
>>> github repo: https://github.com/spell-music/csound-expression
>>>
>>> hackage: http://hackage.haskell.org/package/csound-expression
>>>
>>>
>>> Cheers!
>>>
>>> ___
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe@haskell.org
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>>
>>>
>>
>

-- 

Read the whole topic here: Haskell Art:
http://lurk.org/r/topic/5hKBXBVrxx47BVcVdsQlek

To leave Haskell Art, email haskell-...@group.lurk.org with the following email 
subject: unsubscribe


Re: [haskell art] [Haskell-cafe] the library of beautiful instruments implemented in haskell / csound

2015-09-13 Thread Tom Murphy
These sound great, congratulations! "Batteries included" is a great place
to be. Can you point to references you used to create the instrument
definitions?

Tom


On Sun, Sep 13, 2015 at 9:13 AM, Anton Kholomiov <anton.kholom...@gmail.com>
wrote:

> Status update for my haskell synth csound-expression. The main point is
> presence of many cool instruments. They are implemented in the package
> csound-catalog. All packages are compiled with GHC-7.10 So the hackage
> fails to build them and unfortunately docs a broken too. But you can look
> at the source code of the module Csound.Patch to now  the names of the
> instruments. The usage is pretty straightforward. It's described here:
>
>
> https://github.com/spell-music/csound-expression/blob/master/tutorial/chapters/Patches.md
>
> There is an mp3 file to listen to the instruments.
> http://ge.tt/1jNETqN2/v/0
>
> *The 4.8.3 is out! New features:*
>
> This is a very important release to me. It tries to solve the problem
> present in the most open source music-production libraries. It's often the
> pack of beautiful sounds/timbres is missing. User is presented with many
> audio primitives but no timbres are present to show the real power of the
> framework. This release solves this problem. See the friend package
> csound-catalog on Hackage. It defines 200+ beautiful instruments ready to
> be used.
>
> The csound-expression defines a new type called Patch for description of
> an instrument with a chain of effects. It's good place to start the journey
> to the world of music production.
>
> There are new functions for synchronized reaction on events. The
> triggering of events can be synchronized with given BPM.
>
> The library is updated for GHC-7.10!
>
>
> github repo: https://github.com/spell-music/csound-expression
>
> hackage: http://hackage.haskell.org/package/csound-expression
>
>
> Cheers!
>
> _______
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>

-- 

Read the whole topic here: Haskell Art:
http://lurk.org/r/topic/LXpcfpWIOB9FgiWYyp93a

To leave Haskell Art, email haskell-...@group.lurk.org with the following email 
subject: unsubscribe


[Haskell-cafe] No upgrade of GHC version in Ubuntu repository

2013-10-14 Thread Vlatko Basic

Hi Caffe,

deb packages of GHC (and Haskell Platform) in Ubuntu's (LTS Precise, 12.04) 
universe are not upgrading at all.
GHC package is almost two years old, still on version 7.4.1, and GHC site still 
recommends to use Haskell Platform from repository.



Even kernel is upgrading more often, and one would expect it is much more 
difficult. :-)



What would be the reason for that?
Is it abandoned?


Best regards,

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


Re: [Haskell-cafe] Compiling arbitrary Haskell code

2013-10-14 Thread Daniil Frumin
For those who are interested (and I already chatted with Chris on IRC),
I've implemented a pastebin that is able to (among some other things) to
run arbitrary Haskell code: http://paste.hskll.org/
I've also developed a 'restricted-workers' library for managing processes
that should run in secured environment. I've described some of my endeavors
in a blog post:
http://parenz.wordpress.com/2013/07/15/interactive-diagrams-gsoc-progress-report/

Bottom line: proper restrictions are hard, the necessary tools operate on a
low level, there are some caveats too


On Sat, Oct 12, 2013 at 12:30 AM, Christopher Done chrisd...@gmail.comwrote:

 Is there a definitive list of things in GHC that are unsafe to
 _compile_ if I were to take an arbitrary module and compile it?

 E.g. off the top of my head, things that might be dangerous:

 * TemplateHaskell/QuasiQuotes -- obviously
 * Are rules safe?
 * #includes — I presume there's some security risk with including any old
 file?
 * FFI -- speaks for itself

 I'm interested in the idea of compiling Haskell code on lpaste.org,
 for core, rule firings, maybe even Th expansion, etc. When sandboxing
 code that I'm running, it's really easy if I whitelist what code is
 available (parsing with HSE, whitelisting imports, extensions). The
 problem of infinite loops or too much allocation is fairly
 straight-forwardly solved by similar techniques applied in mueval.

 SafeHaskell helps a lot here, but suppose that I want to also allow
 TemplateHaskell, GeneralizedNewtypeDeriving and stuff like that,
 because a lot of real code uses those. They only seem to be restricted
 to prevent cheeky messing with APIs in ways the authors of the APIs
 didn't want -- but that shouldn't necessarily be a security—in terms
 of my system—problem, should it? Ideally I'd very strictly whitelist
 which modules are allowed to be used (e.g. a version of TH that
 doesn't have runIO), and extensions, and then compile any code that
 uses them.

 I'd rather not have to setup a VM just to compile Haskell code safely.
 I'm willing to put some time in to investigate it, but if there's
 already previous work done for this, I'd appreciate any links.

 At the end of the day, there's always just supporting a subset of
 Haskell using SafeHaskell. I'm just curious about the more general
 case, for use-cases similar to my own.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




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


Re: [Haskell-cafe] No upgrade of GHC version in Ubuntu repository

2013-10-14 Thread Lizanets Danylo
Hi vlatko, 

New versions of GHC are available in newer versions of Ubuntu (12.10, 13.04 
etc.). I recommend you to download, build and install Haskell-platform from 
sources. 

Best regards, 

Danylo Lizanets  

--- Original message --- 
From: Vlatko Basic  vlatko.ba...@gmail.com  
Date: 14 October 2013, 11:44:17 

Hi Caffe,

deb packages of GHC (and Haskell Platform) in Ubuntu's (LTS Precise, 12.04) 
universe are not upgrading at all.
GHC package is almost two years old, still on version 7.4.1, and GHC site still 
recommends to use Haskell Platform from repository.


Even kernel is upgrading more often, and one would expect it is much more 
difficult. :-)


What would be the reason for that?
Is it abandoned?


Best regards,

vlatko
___
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] No upgrade of GHC version in Ubuntu repository

2013-10-14 Thread Vlatko Basic

  
  
Hi Danylo,

I have 7.6.3 already, but I was wondering why the repository
packages are not maintained.
12.04 is an LTS for 5 years, so I suppose many would stick to it for
a longer time.


br,
vlatko


 Original Message 
  Subject: Re: [Haskell-cafe] No upgrade of GHC version in
  Ubuntu repository
  From: Lizanets Danylo iamwea...@ukr.net
  To: vlatko.ba...@gmail.com
  Cc: haskell-cafe@haskell.org
  Date: 14.10.2013 12:40



   
 
Hi vlatko,

New versions of GHC are available in newer versions of Ubuntu
(12.10, 13.04 etc.). I recommend you to download, build and
install Haskell-platform from sources.

Best regards,

Danylo Lizanets  

 --- Original
  message ---
  From: "Vlatko Basic" vlatko.ba...@gmail.com
  Date: 14 October 2013, 11:44:17



  Hi Caffe,

deb packages of GHC (and Haskell Platform) in Ubuntu's (LTS Precise, 12.04) 
"universe" are not upgrading at all.
GHC package is almost two years old, still on version 7.4.1, and GHC site still 
recommends to use Haskell Platform from repository.


Even kernel is upgrading more often, and one would expect it is much more 
difficult. :-)


What would be the reason for that?
Is it abandoned?


Best regards,

vlatko
_______
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] No upgrade of GHC version in Ubuntu repository

2013-10-14 Thread Lizanets Danylo
  Because LTS must be stable. Although you can add some PPA with new versions 
of packages to your software sources list. 

--- Original message --- 
From: Vlatko Basic  vlatko.ba...@gmail.com  
Date: 14 October 2013, 13:28:21 

Hi Danylo, 

I have 7.6.3 already, but I was wondering why the repository packages are not 
maintained. 
12.04 is an LTS for 5 years, so I suppose many would stick to it for a longer 
time. 


br, 
vlatko 

 Original Message  
Subject: Re: [Haskell-cafe] No upgrade of GHC version in Ubuntu repository 
From: Lizanets Danylo iamwea...@ukr.net 
To: vlatko.ba...@gmail.com 
Cc: haskell-cafe@haskell.org 
Date: 14.10.2013 12:40 


Hi vlatko, 

New versions of GHC are available in newer versions of Ubuntu (12.10, 13.04 
etc.). I recommend you to download, build and install Haskell-platform from 
sources. 

Best regards, 

Danylo Lizanets  

--- Original message --- 
From: Vlatko Basic  vlatko.ba...@gmail.com  
Date: 14 October 2013, 11:44:17 

Hi Caffe,

deb packages of GHC (and Haskell Platform) in Ubuntu's (LTS Precise, 12.04) 
universe are not upgrading at all.
GHC package is almost two years old, still on version 7.4.1, and GHC site still 
recommends to use Haskell Platform from repository.


Even kernel is upgrading more often, and one would expect it is much more 
difficult. :-)


What would be the reason for that?
Is it abandoned?


Best regards,

vlatko
___
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] Stackage with GHC 7.8 has started

2013-10-14 Thread Joachim Breitner
Hi,

Am Sonntag, den 13.10.2013, 17:50 +0200 schrieb Michael Snoyman:

 I wanted to announce that FP Complete is now running a Jenkins job to
 build Stackage with GHC 7.8. You can see the current results in the
 relevant Github issue[1]. Essentially, we're still trying to get
 version bounds updated so that a build can commence.

Great!

Is there a way to view the jenkins build results somewhere?

For some reason I miss a proper homepage of stackage with links to all
the various resources (but maybe I’m blind).

Greetings,
Joachim

-- 
Joachim “nomeata” Breitner
  m...@joachim-breitner.de • http://www.joachim-breitner.de/
  Jabber: nome...@joachim-breitner.de  • GPG-Key: 0x4743206C
  Debian Developer: nome...@debian.org


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Stackage with GHC 7.8 has started

2013-10-14 Thread Michael Snoyman
On Mon, Oct 14, 2013 at 3:42 PM, Joachim Breitner
m...@joachim-breitner.dewrote:

 Hi,

 Am Sonntag, den 13.10.2013, 17:50 +0200 schrieb Michael Snoyman:

  I wanted to announce that FP Complete is now running a Jenkins job to
  build Stackage with GHC 7.8. You can see the current results in the
  relevant Github issue[1]. Essentially, we're still trying to get
  version bounds updated so that a build can commence.

 Great!

 Is there a way to view the jenkins build results somewhere?

 For some reason I miss a proper homepage of stackage with links to all
 the various resources (but maybe I’m blind).


No, you're not blind, I just haven't gotten things set up in that manner
yet. Specifically for GHC 7.8, there's nothing to display. Until a pull
request on HTTP is merge[1], there's nothing to show at all from the
Jenkins builds. But once that's done, it would be hard to display the
Jenkins results, since I run half the jobs from my local system, and then
the other half from the FP Complete build server. If anyone has experience
with publishing Jenkin's build reports from two different systems and
wouldn't mind helping me out, please be in touch, it would be nice to get
the information available in a more publicly-accessible manner.

Michael

[1] https://github.com/haskell/HTTP/pull/47
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] No upgrade of GHC version in Ubuntu repository

2013-10-14 Thread Simon Hengel
Hi,

On Mon, Oct 14, 2013 at 01:28:17PM +0200, Vlatko Basic wrote:
 I have 7.6.3 already, but I was wondering why the repository packages are not
 maintained.
 12.04 is an LTS for 5 years, so I suppose many would stick to it for a longer
 time.

I added PPAs for GHC 7.6.3 recently.  Feel free to use:

sudo apt-get --purge remove ghc
sudo apt-get --purge remove cabal-install
sudo apt-add-repository ppa:typeful/ghc-7.6.3
sudo apt-add-repository ppa:typeful/cabal-install
sudo apt-get update
sudo apt-get install ghc cabal-install

This assumes that you only want to install GHC and cabal-install with
apt and everything else from Hackage.

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


Re: [Haskell-cafe] No upgrade of GHC version in Ubuntu repository

2013-10-14 Thread Vlatko Basic

  
  
Looks like we're missing the point here. I did add the PPAs, and all
is OK for me. :-)

LTS is a stable release, and yet many other apps get updated
regulary, but GHC does not. GHC is not part of the system itself,
it's just an app, like many others are. So I expected it to be
updated regularly, as other do.

This way it looks like it is abandoned...




 Original Message 
  Subject: Re: [Haskell-cafe] No upgrade of GHC version in
  Ubuntu repository
  From: Lizanets Danylo iamwea...@ukr.net
  To: vlatko.ba...@gmail.com
  Cc: haskell-cafe@haskell.org
  Date: 14.10.2013 14:38



   
 
  Because LTS must be stable. Although you can add some PPA with
new versions of packages to your software sources list.

 --- Original
  message ---
  From: "Vlatko Basic" vlatko.ba...@gmail.com
  Date: 14 October 2013, 13:28:21


Hi
  Danylo,
  
  I have 7.6.3 already, but I was wondering why the
  repository packages are not maintained.
  12.04 is an LTS for 5 years, so I suppose many would stick
  to it for a longer time.
  
  
  br,
  vlatko
  
  
   Original Message 
Subject: Re: [Haskell-cafe] No upgrade of GHC
version in Ubuntu repository
From: Lizanets Danylo iamwea...@ukr.net
To: vlatko.ba...@gmail.com
    Cc: haskell-cafe@haskell.org
Date: 14.10.2013 12:40
  
  
  
 
   
  Hi vlatko,
  
  New versions of GHC are available in newer versions of
  Ubuntu (12.10, 13.04 etc.). I recommend you to
  download, build and install Haskell-platform from
  sources.
  
  Best regards,
  
  Danylo Lizanets  
  
  
--- Original message ---
From: "Vlatko Basic" vlatko.ba...@gmail.com
Date: 14 October 2013, 11:44:17
  
  
  
Hi Caffe,

deb packages of GHC (and Haskell Platform) in Ubuntu's (LTS Precise, 12.04) 
"universe" are not upgrading at all.
GHC package is almost two years old, still on version 7.4.1, and GHC site still 
recommends to use Haskell Platform from repository.


Even kernel is upgrading more often, and one would expect it is much more 
difficult. :-)


What would be the reason for that?
Is it abandoned?


Best regards,

vlatko
___________
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] No upgrade of GHC version in Ubuntu repository

2013-10-14 Thread Vlatko Basic

Hi Simon,

Thanks for that.
I already have it on the list, and this one:
 ppa:fmarier/git-annex
with many packages already precompiled.
(if someone doesn't want cabal)


br,

vlatko

 Original Message  
Subject: Re: [Haskell-cafe] No upgrade of GHC version in Ubuntu repository
From: Simon Hengel s...@typeful.net
To: Vlatko Basic vlatko.ba...@gmail.com
Cc: Lizanets Danylo iamwea...@ukr.net, haskell-cafe@haskell.org
Date: 14.10.2013 15:33


Hi,

On Mon, Oct 14, 2013 at 01:28:17PM +0200, Vlatko Basic wrote:

I have 7.6.3 already, but I was wondering why the repository packages are not
maintained.
12.04 is an LTS for 5 years, so I suppose many would stick to it for a longer
time.


I added PPAs for GHC 7.6.3 recently.  Feel free to use:

 sudo apt-get --purge remove ghc
 sudo apt-get --purge remove cabal-install
 sudo apt-add-repository ppa:typeful/ghc-7.6.3
 sudo apt-add-repository ppa:typeful/cabal-install
 sudo apt-get update
 sudo apt-get install ghc cabal-install

This assumes that you only want to install GHC and cabal-install with
apt and everything else from Hackage.

Cheers,
Simon


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


Re: [Haskell-cafe] Increasing memory use in stream computation

2013-10-14 Thread Arie Peterson
Hi Claude,


On Thursday 10 October 2013 20:05:37 I wrote:
 Although, maybe I can do all the logic of the small function in the list 
 monad, and stream the resulting list, as you do in the above.

I tried a corresponding variant of my full program, but the memory use is 
quite a lot higher at the start, and increases by large amounts (compared to 
the version that streams at all levels).


So, I'm still at a loss.


Regards,

Arie

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


Re: [Haskell-cafe] No upgrade of GHC version in Ubuntu repository

2013-10-14 Thread Joachim Breitner
Hi,

Am Montag, den 14.10.2013, 15:34 +0200 schrieb Vlatko Basic:
 Looks like we're missing the point here. I did add the PPAs, and all
 is OK for me. :-)
 
 LTS is a stable release, and yet many other apps get updated regulary,
 but GHC does not. GHC is not part of the system itself, it's just an
 app, like many others are. So I expected it to be updated regularly,
 as other do.
 
 This way it looks like it is abandoned...

the problem is that if you update GHC, you’ll have to update lots of
other packages, and rebuild all Haskell libraries. It’s difficult enough
to target one release; supporting several would be a considerable amount
of work to the maintainers.

OTOH, it is not clear if they know that there is demand for it, and I
don’t know Ubuntu’s release upgrade policies (Debian, for example, would
not allow such an upgrade in a stable release), but maybe you should ask
the maintainers of Haskell in Ubuntu? See
https://wiki.ubuntu.com/MOTU/Teams/UncommonProgrammingLanguages/Haskell
for a possibly up-to-date list of them.

Greetings,
Joachim

-- 
Joachim nomeata Breitner
Debian Developer
  nome...@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nome...@joachim-breitner.de | http://people.debian.org/~nomeata




signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Stackage with GHC 7.8 has started

2013-10-14 Thread Sebastiaan Visser
Michael,

I see one of my packages is on that list, because of the upper bound on 
template-haskell. I would love the raise the upper bound, but of course only if 
it will actually build.

Can I download a binary version snapshot GHC 7.8 somewhere so I can test and 
apply changes accordingly? I actively avoid building GHC from source.

Thanks,
Sebastiaan


On Oct 13, 2013, at 5:50 PM, Michael Snoyman mich...@snoyman.com wrote:

 Hi everyone,
 
 I wanted to announce that FP Complete is now running a Jenkins job to build 
 Stackage with GHC 7.8. You can see the current results in the relevant Github 
 issue[1]. Essentially, we're still trying to get version bounds updated so 
 that a build can commence.
 
 I'd like to ask two things from the community:
 
 * If you have a package with a restrictive upper bound, now's a good time to 
 start testing that package with GHC 7.8 and relaxing those upper bounds. It 
 would be great if, when GHC 7.8 is released, a large percentage of Hackage 
 already compiled with it.
 * If you have a package on Hackage that is not yet on Stackage, now's a great 
 time to add it. We're going to be doing daily builds against three versions 
 of GHC (7.4.2, 7.6.3, and 7.8), which will help ensure your packages continue 
 to build consistently.
 
 Michael
 
 [1] https://github.com/fpco/stackage/issues/128

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


[Haskell-cafe] Xcode 5 support for GHC iOS

2013-10-14 Thread Luke Iannini
Hi all,

Just wanted to let you know I've finished updating GHC iOS to support Xcode
5. The new scripts are at
https://github.com/ghc-ios/ghc-ios-scripts/tree/xcode5 and you'll find
updated instructions at
http://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling/iOS .

Please let me know if you have any trouble!
Cheers
Luke
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Nested monadic monoids via Traversable?

2013-10-13 Thread Hans Höglund
If anyone is interested, Typeclassopedia pointed me to Composing Monads by 
Jones and Duponcheel (1993), which contains exactly my implementation along 
with some other nice patterns for composing Monads via Traversable.sequence 
(called swap in the paper) and related operators. It would be interesting to 
see these ideas reimagined with modern type classes.

You can find the paper here:
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.138.4552

Regards,
Hans


On 10 okt 2013, at 18:25, Hans Höglund wrote:

 I have been experimenting with compositions of monads carrying associated 
 monoids (i.e. Writer-style) and discovered the following pattern:
 
 --
 {-# LANGUAGE 
DeriveFunctor,
DeriveFoldable,
DeriveTraversable,
GeneralizedNewtypeDeriving #-}
 
 import Control.Monad
 import Control.Monad.Writer hiding (())
 import Data.Semigroup
 import Data.Foldable (Foldable)
 import Data.Traversable (Traversable)
 import qualified Data.Traversable as Traversable
 
 newtype Foo m a = Foo (Writer m a)
deriving (Monad, MonadWriter m, Functor, Foldable, Traversable)
 
 newtype Bar m a = Bar { getBar :: [Foo m a] }
deriving (Semigroup, Functor, Foldable, Traversable)
 instance Monoid m = Monad (Bar m) where
return = Bar . return . return
Bar ns = f = Bar $ ns = joinedSeq . fmap (getBar . f)
where
joinedSeq = fmap join . Traversable.sequence
 
 runFoo (Foo x) = runWriter x
 runBar (Bar xs) = fmap runFoo xs
 --
 
 That is, given a type that is Monadic and Traversable, we can define a list 
 of the same type as a monad, whose binding action glues together the nested 
 Monoid values. A trivial example:
 
 --
 -- annotate all elements in bar
 tells :: String - Bar String a - Bar String a
 tells a (Bar xs) = Bar $ fmap (tell a ) xs
 
 -- a bar with no annotations
 x :: Bar String Int
 x = return 0
 
 -- annotations compose with =
 y :: Bar String Int
 y = x  tells a x = (tells b . return)
 
 -- and with join
 z :: Bar String Int
 z = join $ tells d $ return (tells c (return 0)  return 1)
 
 -- runBar y == [(0,b),(0,ab)]
 -- runBar z == [(0,dc),(1,d)]
 --
 
 However, I am concerned about the (Monad Bar) instance which seems ad-hoc to 
 me, especially the use of sequence. Is there a more general pattern which 
 uses a class other than Traversable? Any pointers would be much appreciated.
 
 Regards,
 Hans
 
 

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


[Haskell-cafe] Stackage with GHC 7.8 has started

2013-10-13 Thread Michael Snoyman
Hi everyone,

I wanted to announce that FP Complete is now running a Jenkins job to build
Stackage with GHC 7.8. You can see the current results in the relevant
Github issue[1]. Essentially, we're still trying to get version bounds
updated so that a build can commence.

I'd like to ask two things from the community:

* If you have a package with a restrictive upper bound, now's a good time
to start testing that package with GHC 7.8 and relaxing those upper bounds.
It would be great if, when GHC 7.8 is released, a large percentage of
Hackage already compiled with it.
* If you have a package on Hackage that is not yet on Stackage, now's a
great time to add it. We're going to be doing daily builds against three
versions of GHC (7.4.2, 7.6.3, and 7.8), which will help ensure your
packages continue to build consistently.

Michael

[1] https://github.com/fpco/stackage/issues/128
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ordNub

2013-10-13 Thread AntC
 Niklas Hambüchen mail at nh2.me writes:
 
 In sets, the order does not matter, while for nub it does.
 

Let's be careful here!. Niklas, when you say order, do you mean:
* the _ordering_ from the Ord instance? Or
* the relative sequence of elements in the list?

 ... the fact that Set is used inside my proposed 
 ordNub implementation is a detail not visible to the caller.

If you use the Set library, that fact may be very visible!
Because Set re-sequences the whole list, as per its Ord instance.

But List.nub preserves the list sequence (except for omitting duplicates).

Furthermore, the Ord instance might compare two elements as EQ, even 
though their Eq instance says they're not equal.

So a Set-based ordNub could end up returning:
* not the same elements as List.nub
* and/or not in the same list sequence

I'd call that very much *visible* to the caller.

 
 That's why it looks like a Data.List function to me.
 

[BTW I am still less than convinced that overall a Set-based ordNub is 
significantly more efficient. I suspect it depends on how big is your 
list.]


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


Re: [Haskell-cafe] ordNub

2013-10-13 Thread Niklas Hambüchen
On 13/10/13 21:42, AntC wrote:
 Niklas Hambüchen mail at nh2.me writes:

 In sets, the order does not matter, while for nub it does.

 
 Let's be careful here!. Niklas, when you say order, do you mean:
 * the _ordering_ from the Ord instance? Or
 * the relative sequence of elements in the list?
 
 ... the fact that Set is used inside my proposed 
 ordNub implementation is a detail not visible to the caller.
 
 If you use the Set library, that fact may be very visible!
 Because Set re-sequences the whole list, as per its Ord instance.
 
 But List.nub preserves the list sequence (except for omitting duplicates).

I mean *exactly* what you say here.

ordNub behaves has the same behaviour as nub, while (Set.toList .
Set.fromList) doesn't.

 [BTW I am still less than convinced that overall a Set-based ordNub is 
 significantly more efficient. I suspect it depends on how big is your 
 list.]

What do you mean?

ordNub is clearly in a different complexity class, and the benchmarks
that I provided show not only this, but also that ordNub is *always*
faster than nub, even for singleton lists.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ordNub

2013-10-13 Thread AntC
 Niklas Hambüchen mail at nh2.me writes:
 
  On 13/10/13 21:42, AntC wrote:
  ...
  If you use the Set library, that fact may be very visible!
  Because Set re-sequences the whole list, as per its Ord instance.
  
  But List.nub preserves the list sequence
  (except for omitting duplicates).
 
 I mean *exactly* what you say here.
 
 ordNub behaves has the same behaviour as nub, while (Set.toList .
 Set.fromList) doesn't.
 

That's great, thank you.

  [BTW I am still less than convinced that overall a Set-based ordNub is 
  significantly more efficient. I suspect it depends on how big is your 
  list.]
 
 What do you mean?
 
 ordNub is clearly in a different complexity class, ...

Yes, I'm not disputing that.

 ... and the benchmarks that I provided show not only this,
 but also that ordNub is *always* faster than nub,
 even for singleton lists.

Thanks Niklas, I hadn't spotted those benchmarks back in July.

I'm surprised at that result for singletons 
(and for very small numbers of elements which are in fact each different).

Especially because List's `nub` uses `filter` == fold, which should be 
tail-recursive.

It seems to me that for small numbers, the Set-based approach still 
requires comparing each element to each other. Plus there's the overhead 
for building the Set and inserting each element into it -- where `insert` 
again walks the Set to find the insertion point.

Then here's a further possible optimisation, instead of making separate 
calls to `member` and `insert`:
* Make a single call to
insert' :: (Ord a) = a - Set a - (Bool, Set a)
* The Bool returns True if already a member.
* Else returns an updated Set in the snd, with the element inserted.



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


Re: [Haskell-cafe] ordNub

2013-10-13 Thread Niklas Hambüchen
On 14/10/13 03:20, AntC wrote:
 Thanks Niklas, I hadn't spotted those benchmarks back in July.

No worries :)

 I'm surprised at that result for singletons 
 (and for very small numbers of elements which are in fact each different).

I think one of the main reasons for the performance difference is that a
list node and a Set binary tree node have pretty much the same
performance, with the difference that in


http://hackage.haskell.org/package/containers-0.5.2.1/docs/src/Data-Set-Base.html

   data Set a = Bin {-# UNPACK #-} !Size !a !(Set a) !(Set a) | Tip

there are strictness and unpack annotations, while for

   data [a] = [] | a : [a] -- pseudo syntax

there are not.

Good for us in this case, I guess.

 It seems to me that for small numbers, the Set-based approach still 
 requires comparing each element to each other.

This I don't understand.

 Then here's a further possible optimisation, instead of making separate 
 calls to `member` and `insert`:

This I understand again. Where do you get insert' from? containers
doesn't seem to have it. Do you suggest adding it?

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


Re: [Haskell-cafe] ordNub

2013-10-13 Thread AntC
 Niklas Hambüchen mail at nh2.me writes:
 
  On 14/10/13 03:20, AntC wrote:
  ... 
  Then here's a further possible optimisation, instead of making 
  separate calls to `member` and `insert`:
 
 This I understand again. Where do you get insert' from? containers
 doesn't seem to have it. Do you suggest adding it?
 

err, well I didn't have any specific library in mind.

More there's a kind of 'folk idiom' for managing data structures,
(this applies more for imperative code/update-in-situ than functional)
that if you know the next thing you're going to do after failing to find 
an element is insert it, you might as well get on with the insert there 
and then.

(It's a higher-level analogue of a machine instruction decrement-and-
branch-if-zero.)

I'm looking at all the remarks about managing libraries and dependencies.
Would it make sense to build a stand-alone version of Set purely to 
support ordNub? Then it needs only methods `empty` and `insertIfAbsent`.



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


Re: [Haskell-cafe] typeclass to select a list element

2013-10-12 Thread Paolino
Hello everyone,

I'm still trying to resolve my problem. I try to restate it in a simpler
way.
Is it possible to write extract and update functions for L ?

import Data.Nat

data family X (n::Nat) :: *

data L (n::Nat) where
Q :: L (Succ n) - X n - L n
E :: L n

extract :: L Zero - X n
extract = undefined

update :: L Zero - (X n - X n) - L Zero
update = undefined

Thanks for hints and help

paolino



2013/10/7 Paolino paolo.verone...@gmail.com

 Hello, I'm trying to use a type class to select an element from a list.
 I would like to have a String CC as a value for l10'.


 {-# LANGUAGE MultiParamTypeClasses, GADTs,FlexibleInstances,  DataKinds
 ,TypeFamilies, KindSignatures, FlexibleContexts, OverlappingInstances,
 StandaloneDeriving, UndecidableInstances #-}



 import Data.Nat
 import Data.Monoid

 data family X (n::Nat) :: *

 data L (n::Nat) where
 Q :: (Monoid (X n), Show (X n)) = L (Succ n) - X n - L n
 E :: Monoid (X n) = L n

 deriving instance Show (L n)
 data instance X n = String String

 instance Monoid (X n) where
 String x `mappend` String y = String $ x `mappend` y
 mempty = String 
 deriving instance Show (X n)

 class Compose n n' where
 compose :: L n  - L n  - X n'

 instance Compose n n where
 compose (Q _ x) (Q _ y) = x `mappend` y
 compose _ _ = mempty

 instance Compose n n' where
 compose (Q x _) (Q y _) = compose x y
 compose _ _ = mempty

 l0 :: L Zero
 l0 = Q (Q E $ String C) $ String A

 l0' :: L Zero
 l0' = Q (Q E $ String C) $ String B


 l10' :: X (Succ Zero)
 l10' = compose l0 l0'

 l00' :: X Zero
 l00' = compose l0 l0'
 {-

 *Main l00'
 String AB
 *Main l10'
 String 

 -}

 Thanks for help.

 paolino

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


Re: [Haskell-cafe] typeclass to select a list element

2013-10-12 Thread adam vogt
Hi Paolino,

There are some functions similar to that in HList (Data.HList.HArray).
Check the repo http://code.haskell.org/HList for a version that uses
more type families / gadts.

Maybe there is a way to take advantage of the fact that you've
labelled the elements of the list, but extract isn't too bad if you
don't: http://lpaste.net/94210.

Regards,
Adam

On Sat, Oct 12, 2013 at 4:41 AM, Paolino paolo.verone...@gmail.com wrote:
 Hello everyone,

 I'm still trying to resolve my problem. I try to restate it in a simpler
 way.
 Is it possible to write extract and update functions for L ?

 import Data.Nat


 data family X (n::Nat) :: *

 data L (n::Nat) where
 Q :: L (Succ n) - X n - L n
 E :: L n

 extract :: L Zero - X n
 extract = undefined

 update :: L Zero - (X n - X n) - L Zero
 update = undefined

 Thanks for hints and help

 paolino



 2013/10/7 Paolino paolo.verone...@gmail.com

 Hello, I'm trying to use a type class to select an element from a list.
 I would like to have a String CC as a value for l10'.


 {-# LANGUAGE MultiParamTypeClasses, GADTs,FlexibleInstances,  DataKinds
 ,TypeFamilies, KindSignatures, FlexibleContexts, OverlappingInstances,
 StandaloneDeriving, UndecidableInstances #-}



 import Data.Nat
 import Data.Monoid

 data family X (n::Nat) :: *

 data L (n::Nat) where
 Q :: (Monoid (X n), Show (X n)) = L (Succ n) - X n - L n
 E :: Monoid (X n) = L n

 deriving instance Show (L n)
 data instance X n = String String

 instance Monoid (X n) where
 String x `mappend` String y = String $ x `mappend` y
 mempty = String 
 deriving instance Show (X n)

 class Compose n n' where
 compose :: L n  - L n  - X n'

 instance Compose n n where
 compose (Q _ x) (Q _ y) = x `mappend` y
 compose _ _ = mempty

 instance Compose n n' where
 compose (Q x _) (Q y _) = compose x y
 compose _ _ = mempty

 l0 :: L Zero
 l0 = Q (Q E $ String C) $ String A

 l0' :: L Zero
 l0' = Q (Q E $ String C) $ String B


 l10' :: X (Succ Zero)
 l10' = compose l0 l0'

 l00' :: X Zero
 l00' = compose l0 l0'
 {-

 *Main l00'
 String AB
 *Main l10'
 String 

 -}

 Thanks for help.

 paolino



 ___
 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] ordNub

2013-10-12 Thread Niklas Hambüchen
I would like to come back to the original question:

How can ordNub be added to base?

I guess we agree that Data.List is the right module for a function of
type Ord a = [a] - [a], but this introduces

* a cyclic dependency between Data.List and Data.Set
* a base dependency on containers.

What is the right way to go with that?

Should ordNub be introduced as part of Data.Set, as Conrad suggested?

It does not really have anything to do with Set, apart from being
implemented with it.

On 14/07/13 14:12, Roman Cheplyaka wrote:
 Something like that should definitely be included in Data.List.
 Thanks for working on it.
 
 Roman
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ordNub

2013-10-12 Thread Anthony Cowley

On Oct 12, 2013, at 2:47 PM, Niklas Hambüchen m...@nh2.me wrote:
 
 I would like to come back to the original question:
 
 How can ordNub be added to base?
 
 I guess we agree that Data.List is the right module for a function of
 type Ord a = [a] - [a], but this introduces
 
 * a cyclic dependency between Data.List and Data.Set
 * a base dependency on containers.
 
 What is the right way to go with that?
 
 Should ordNub be introduced as part of Data.Set, as Conrad suggested?
 
 It does not really have anything to do with Set, apart from being
 implemented with it.

I think nub's behavior is rather set-related, so I don't really understand the 
objection to putting it in Data.Set.

Anthony

 
 On 14/07/13 14:12, Roman Cheplyaka wrote:
 Something like that should definitely be included in Data.List.
 Thanks for working on it.
 
 Roman
 ___
 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] ordNub

2013-10-12 Thread Niklas Hambüchen
On 12/10/13 20:43, Anthony Cowley wrote:
 I think nub's behavior is rather set-related, so I don't really understand 
 the objection to putting it in Data.Set.

In sets, the order does not matter, while for nub it does.

nub:: Eq a  = [a] - [a]
ordNub :: Ord a = [a] - [a]

both do not mention Set, and the fact that Set is used inside my
proposed ordNub implementation is a detail not visible to the caller.

That's why it looks like a Data.List function to me.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ordNub

2013-10-12 Thread Roman Cheplyaka
* Anthony Cowley acow...@seas.upenn.edu [2013-10-12 15:43:57-0400]
 
 On Oct 12, 2013, at 2:47 PM, Niklas Hambüchen m...@nh2.me wrote:
  
  I would like to come back to the original question:
  
  How can ordNub be added to base?
  
  I guess we agree that Data.List is the right module for a function of
  type Ord a = [a] - [a], but this introduces
  
  * a cyclic dependency between Data.List and Data.Set
  * a base dependency on containers.
  
  What is the right way to go with that?
  
  Should ordNub be introduced as part of Data.Set, as Conrad suggested?
  
  It does not really have anything to do with Set, apart from being
  implemented with it.
 
 I think nub's behavior is rather set-related, so I don't really
 understand the objection to putting it in Data.Set.

It's not Set (in the data structure sense) related. It's list-related,
because it clearly acts on lists.

Therefore, it belongs to Data.List.

Besides, we already have the precedent of the slow nub being in
Data.List.

Roman


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


[Haskell-cafe] Haskellers in Nashville,TN

2013-10-12 Thread heathmatlock
Anyone here from the Nashville, TN area? t would be nice to meet
regularly with others to discuss and work with Haskell. Also, this
group is now available:

www.meetup.com/The-Haskell-Study-Group/

If you want to participate remotely, that works too, I'm just looking
for others to meet with regularly.

-- 
Heath Matlock
+1 256 274 4225
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] typeclass to select a list element

2013-10-12 Thread Richard Eisenberg
Yes, it's possible, but it's rather painful.

Here is my working attempt, written to be compatible with GHC 7.6.3. Better 
ones may be possible, but I'm doubtful.

 {-# LANGUAGE TemplateHaskell, RankNTypes, TypeFamilies, TypeOperators,
  DataKinds, ScopedTypeVariables, GADTs, PolyKinds #-}
 
 module ListNat where
 
 import Data.Singletons
 
 $(singletons [d|
   data Nat = Zero | Succ Nat deriving Eq
   |])
 
 -- in HEAD, these next two are defined in Data.Type.Equality
 data a :~: b where
   Refl :: a :~: a
 
 gcastWith :: (a :~: b) - ((a ~ b) = r) - r
 gcastWith Refl x = x
 
 -- functionality that subsumes this will be in the next release of singletons
 reifyNatEq :: forall (m :: Nat) (n :: Nat). ((m :==: n) ~ True, SingI m, 
 SingI n) = m :~: n
 reifyNatEq =
   case (sing :: Sing m, sing :: Sing n) of
 (SZero, SZero) - Refl
 (SSucc (_ :: Sing m'), SSucc (_ :: Sing n')) -
   gcastWith (reifyNatEq :: (m' :~: n')) Refl
 _ - bugInGHC   -- this is necessary to prevent a spurious warning from 
 GHC
 
 data family X (n::Nat) :: * 
 
 data L (n::Nat) where
 Q :: L (Succ n) - X n - L n 
 E :: L n
 
 extract :: SingI n = L Zero - X n
 extract = aux
   where
 aux :: forall m n. (SingI m, SingI n) = L m - X n
 aux list =
   case ((sing :: Sing m) %==% (sing :: Sing n), list) of
 (_,  E) - error Desired element does not exist
 (STrue,  Q _ datum) - gcastWith (reifyNatEq :: (m :~: n)) datum
 (SFalse, Q rest _)  - aux rest
 
 update :: forall n. SingI n = L Zero - (X n - X n) - L Zero
 update list upd = aux list
   where
 aux :: forall m. SingI m = L m - L m
 aux list =
   case ((sing :: Sing m) %==% (sing :: Sing n), list) of
 (_, E) - error Desired element does not exist
 (STrue, Q rest datum) - gcastWith (reifyNatEq :: (m :~: n)) (Q rest 
 (upd datum))
 (SFalse, Q rest datum) - Q (aux rest) datum

Why is this so hard? There are two related sources of difficulty. The first is 
that `extract` and `update` require *runtime* information about the *type* 
parameter `n`. But, types are generally erased during compilation. So, the way 
to get the data you need is to use a typeclass (as your subject line suggests). 
The other source of difficulty is that you need to convince GHC that you've 
arrived at the right element when you get there; otherwise, your code won't 
type-check. The way to do this is, in my view, singletons.

For better or worse, your example requires checking the equality of numbers at 
a value other than Zero. The singletons library doesn't do a great job of this, 
which is why we need the very clunky reifyNatEq. I'm hoping to add better 
support for equality-oriented operations in the next release of singletons.

I'm happy to explain the details of the code above, but it might be better as 
QA instead of me just trying to walk through it -- there's a lot of gunk to 
stare at there!

I hope this helps,
Richard


On Oct 12, 2013, at 4:41 AM, Paolino wrote:

 Hello everyone,
 
 I'm still trying to resolve my problem. I try to restate it in a simpler way.
 Is it possible to write extract and update functions for L ?
 
 import Data.Nat
 
 data family X (n::Nat) :: * 
 
 data L (n::Nat) where
 Q :: L (Succ n) - X n - L n 
 E :: L n
 
 extract :: L Zero - X n
 extract = undefined
 
 update :: L Zero - (X n - X n) - L Zero
 update = undefined
 
 Thanks for hints and help
 
 paolino
 
 
 
 2013/10/7 Paolino paolo.verone...@gmail.com
 Hello, I'm trying to use a type class to select an element from a list.
 I would like to have a String CC as a value for l10'.
 
 
 {-# LANGUAGE MultiParamTypeClasses, GADTs,FlexibleInstances,  DataKinds 
 ,TypeFamilies, KindSignatures, FlexibleContexts, OverlappingInstances, 
 StandaloneDeriving, UndecidableInstances #-}
 
 
 
 import Data.Nat
 import Data.Monoid
 
 data family X (n::Nat) :: * 
 
 data L (n::Nat) where
 Q :: (Monoid (X n), Show (X n)) = L (Succ n) - X n - L n 
 E :: Monoid (X n) = L n
 
 deriving instance Show (L n)
 data instance X n = String String
 
 instance Monoid (X n) where
 String x `mappend` String y = String $ x `mappend` y
 mempty = String 
 deriving instance Show (X n)
 
 class Compose n n' where
 compose :: L n  - L n  - X n'
 
 instance Compose n n where
 compose (Q _ x) (Q _ y) = x `mappend` y
 compose _ _ = mempty
 
 instance Compose n n' where
 compose (Q x _) (Q y _) = compose x y 
 compose _ _ = mempty
 
 l0 :: L Zero
 l0 = Q (Q E $ String C) $ String A 
 
 l0' :: L Zero
 l0' = Q (Q E $ String C) $ String B 
 
 
 l10' :: X (Succ Zero)
 l10' = compose l0 l0'
 
 l00' :: X Zero
 l00' = compose l0 l0'
 {-
 
 *Main l00'
 String AB
 *Main l10'
 String 
 
 -}
 
 Thanks for help.
 
 paolino
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Suppressing HLint on pattern match of files

2013-10-11 Thread Dag Odenhall
Just add it next to -Wall wherever you‘re setting that, because I think you
must be setting that yourself somewhere (it’s not on by default).


On Thu, Oct 10, 2013 at 6:11 PM, Graham Berks gra...@fatlazycat.com wrote:

 Ah good point :) Wonder if I can change it on cabal file somehow.

 Thanks



 On 10 October 2013 at 14:05:45, Dag Odenhall 
 (dag.odenh...@gmail.com//dag.odenh...@gmail.com)
 wrote:

  Is that actually from HLint though? I think that comes from GHC with
 -Wall and can be disabled with -fno-warn-missing-signatures.


 On Thu, Oct 10, 2013 at 7:50 AM, Graham Berks gra...@fatlazycat.comwrote:

  Hi, would like to disable 'Top-level binding with no type signature'

  In my test modules that are prefixed with Test.

  Is this possible ??

  Thanks




 ___
 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


[Haskell-cafe] MonadBaseControl IO instance for conduits ?

2013-10-11 Thread Aleksey Uymanov
Hello Haskellers! 

Is it posible to create instance of MonadBaseControl IO (ConduitM i o m) ?

This would give a great posibility to catch exceptions just inside the
ConduitM monad with lifted-base package. And more, http-conduit's
`withManager` restricts base monad (which must be base for ConduitM)
with MonadBaseControl IO.


-- 
Aleksey Uymanov s9gf4...@gmail.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Suppressing HLint on pattern match of files

2013-10-11 Thread Adam Bergmark
You can also do this on a module basis with {-# OPTIONS
-fno-warn-missing-signatures  #-}. I prefer adding type signatures even for
cases where I don't think it's important. GHC spits them out so almost no
time spent, and someone might find it useful at some point.




On Fri, Oct 11, 2013 at 5:53 PM, Dag Odenhall dag.odenh...@gmail.comwrote:

 Just add it next to -Wall wherever you‘re setting that, because I think
 you must be setting that yourself somewhere (it’s not on by default).


 On Thu, Oct 10, 2013 at 6:11 PM, Graham Berks gra...@fatlazycat.comwrote:

 Ah good point :) Wonder if I can change it on cabal file somehow.

 Thanks



 On 10 October 2013 at 14:05:45, Dag Odenhall 
 (dag.odenh...@gmail.com//dag.odenh...@gmail.com)
 wrote:

  Is that actually from HLint though? I think that comes from GHC with
 -Wall and can be disabled with -fno-warn-missing-signatures.


 On Thu, Oct 10, 2013 at 7:50 AM, Graham Berks gra...@fatlazycat.comwrote:

  Hi, would like to disable 'Top-level binding with no type signature'

  In my test modules that are prefixed with Test.

  Is this possible ??

  Thanks




 ___
 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


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


Re: [Haskell-cafe] Store type-class polymorphic values generically

2013-10-11 Thread Christopher Done
 Wait... what do you mean Core cannot generate new names to be exported.

I meant if I add a new name in the Core transformation, that doesn't
change the module's export list as seen by everything outside that
module. Which makes sense, it just means I have to change my approach.

 Maybe you mean that you want your plugin to transform

 module M( f ) where
   f = e
 into
 module M( f_ ) where
   f_ = ...f...
   f = e


No, I meant that

module M(f) where f = e

should be come

module M (f, f_) where f = readRefOf f_; f_ = makeSomeRef e

In other words, the API is only changed in that an additional binding
has been exported for each top-level definition to which you can write
(only of the correct type) a new definition. This is something that
you could do manually, write it by hand, but I want it automatic for
any module I load into GHCi!

 That seems pretty drastic, because now the programmer's API for the module 
 has changed.  Are you sure you don't want to do this

 module M( f ) wehre
   f_ = e
   f = ...f_...

 by renaming the existing f with some local name.

Sure -- but both need to be exported otherwise you can't update the
definition of `f` by writing to `f_`. With both, all other modules
(and the module itself) just refer to `f' as they normally would, it's
just that `f` gets its definition from some kind of mutable cell.

I discussed with Daniel Peebles an approach to this with the new kind
polymorphic Typeable landing in GHC 7.8, in which I could safely write
functions in and out with Fun from HList:
http://code.haskell.org/~aavogt/HList/docs/HList/Data-HList-FakePrelude.html#t:Fun
Hypothetically I can use bog standard Typeable deriving for that type,
and actually use Data.Dynamic to store all functions, using
fromDynamic :: a - Maybe safe coercion. Don't get me wrong, I don't
want the plugin to break any APIs or do anything unsafe (beyond using
unsafePerformIO to hold a Map Name Dynamic or so), I just want
in-place update of IO-ish actions. I'm compiling GHC from Git at the
moment to see if this approach is worthwhile.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Compiling arbitrary Haskell code

2013-10-11 Thread Christopher Done
Is there a definitive list of things in GHC that are unsafe to
_compile_ if I were to take an arbitrary module and compile it?

E.g. off the top of my head, things that might be dangerous:

* TemplateHaskell/QuasiQuotes -- obviously
* Are rules safe?
* #includes — I presume there's some security risk with including any old file?
* FFI -- speaks for itself

I'm interested in the idea of compiling Haskell code on lpaste.org,
for core, rule firings, maybe even Th expansion, etc. When sandboxing
code that I'm running, it's really easy if I whitelist what code is
available (parsing with HSE, whitelisting imports, extensions). The
problem of infinite loops or too much allocation is fairly
straight-forwardly solved by similar techniques applied in mueval.

SafeHaskell helps a lot here, but suppose that I want to also allow
TemplateHaskell, GeneralizedNewtypeDeriving and stuff like that,
because a lot of real code uses those. They only seem to be restricted
to prevent cheeky messing with APIs in ways the authors of the APIs
didn't want -- but that shouldn't necessarily be a security—in terms
of my system—problem, should it? Ideally I'd very strictly whitelist
which modules are allowed to be used (e.g. a version of TH that
doesn't have runIO), and extensions, and then compile any code that
uses them.

I'd rather not have to setup a VM just to compile Haskell code safely.
I'm willing to put some time in to investigate it, but if there's
already previous work done for this, I'd appreciate any links.

At the end of the day, there's always just supporting a subset of
Haskell using SafeHaskell. I'm just curious about the more general
case, for use-cases similar to my own.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Compiling arbitrary Haskell code

2013-10-11 Thread Jason Dagit
On Fri, Oct 11, 2013 at 1:30 PM, Christopher Done chrisd...@gmail.comwrote:

 Is there a definitive list of things in GHC that are unsafe to
 _compile_ if I were to take an arbitrary module and compile it?

 E.g. off the top of my head, things that might be dangerous:

 * TemplateHaskell/QuasiQuotes -- obviously
 * Are rules safe?
 * #includes — I presume there's some security risk with including any old
 file?
 * FFI -- speaks for itself


It really depends on the security properties you want to maintain. That
should inform your policy. For example, denial of service vs. leaking
information (like password db) vs. allowing yourself to become part of a
botnet. There are lots of things to consider here.

For example, lambdabot has always disallowed IO and thus needs to disallow
unsafeCoerce/unsafePerformIO/unsafeInterleaveIO and anything else that
introduces a backdoor in the type system. I think the list you have above
is a good start, but wouldn't be complete for lambdabot.



 I'm interested in the idea of compiling Haskell code on lpaste.org,
 for core, rule firings, maybe even Th expansion, etc. When sandboxing
 code that I'm running, it's really easy if I whitelist what code is
 available (parsing with HSE, whitelisting imports, extensions). The
 problem of infinite loops or too much allocation is fairly
 straight-forwardly solved by similar techniques applied in mueval.


What type of sandboxing do you plan to use and what limitations does it
have? For example, chroot jails can be defeated.



 SafeHaskell helps a lot here, but suppose that I want to also allow
 TemplateHaskell, GeneralizedNewtypeDeriving and stuff like that,
 because a lot of real code uses those. They only seem to be restricted
 to prevent cheeky messing with APIs in ways the authors of the APIs
 didn't want -- but that shouldn't necessarily be a security—in terms
 of my system—problem, should it? Ideally I'd very strictly whitelist
 which modules are allowed to be used (e.g. a version of TH that
 doesn't have runIO), and extensions, and then compile any code that
 uses them.


GND can be used to cause a segfault. I don't know if it can be used to
cause a more serious exploit, but I would be concerned that it can. Then
again, if you're already allowing TH or arbitrary IO then those are
probably much easier places to attack so it may not matter.



 I'd rather not have to setup a VM just to compile Haskell code safely.
 I'm willing to put some time in to investigate it, but if there's
 already previous work done for this, I'd appreciate any links.


I don't know how well it's documented, but lambdabot has a long history of
restricting the Haskell it accepts to make it safe. Other things to look
at, google native client (to see how they approach sandboxing), and geordi
the C++ IRC bot.

In the native client case they do fancy tricks with segment registers (to
control where the sandboxed process can write to memory) and intercepting
system calls in the outer part of the process. They have the case where
they do everything in one process in one address space. You could imagine
porting the GHC RTS to run in native client (didn't someone start on that?)
and then using that to sandbox all your Haskell evaluation.



 At the end of the day, there's always just supporting a subset of
 Haskell using SafeHaskell. I'm just curious about the more general
 case, for use-cases similar to my own.


I think SafeHaskell is a reasonable starting place, but I don't think it
gives you a really strong guarantee yet. Everything that is inferred safe
probably is (I don't know of any exploits with that part of SafeHaskell).
In practice, you'll probably also want to use some trusted packages, but
that requires that none of the stuff your trust is exploitable.

I hope that helps,
Jason
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Compiling arbitrary Haskell code

2013-10-11 Thread Aleksey Khudyakov

On 12.10.2013 00:30, Christopher Done wrote:

Is there a definitive list of things in GHC that are unsafe to
_compile_ if I were to take an arbitrary module and compile it?

E.g. off the top of my head, things that might be dangerous:

* TemplateHaskell/QuasiQuotes -- obviously
* Are rules safe?
* #includes — I presume there's some security risk with including any old file?
* FFI -- speaks for itself

I'm interested in the idea of compiling Haskell code on lpaste.org,
for core, rule firings, maybe even Th expansion, etc. When sandboxing
code that I'm running, it's really easy if I whitelist what code is
available (parsing with HSE, whitelisting imports, extensions). The
problem of infinite loops or too much allocation is fairly
straight-forwardly solved by similar techniques applied in mueval.

Pragma GHC_OPTIONS. You can add custom preprocessor for example bash and 
then interpret program as bash script. I think sandboing compiler

is a must. There are just too many handles and hooks to cater to all
possible uses. Some of them must be exploitable.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Compiling arbitrary Haskell code

2013-10-11 Thread Johan Tibell
Whatever guarantees GHC offers (e.g. using Safe Haskell), I would always
run things like these in a sandbox. It's much better for security to
dissallow everything and then whitelist some things (e.g. let the sandbox
communicate with the rest of the world in some limited way) than the other
way around.

Same goes for running untrusted code.


On Fri, Oct 11, 2013 at 1:30 PM, Christopher Done chrisd...@gmail.comwrote:

 Is there a definitive list of things in GHC that are unsafe to
 _compile_ if I were to take an arbitrary module and compile it?

 E.g. off the top of my head, things that might be dangerous:

 * TemplateHaskell/QuasiQuotes -- obviously
 * Are rules safe?
 * #includes — I presume there's some security risk with including any old
 file?
 * FFI -- speaks for itself

 I'm interested in the idea of compiling Haskell code on lpaste.org,
 for core, rule firings, maybe even Th expansion, etc. When sandboxing
 code that I'm running, it's really easy if I whitelist what code is
 available (parsing with HSE, whitelisting imports, extensions). The
 problem of infinite loops or too much allocation is fairly
 straight-forwardly solved by similar techniques applied in mueval.

 SafeHaskell helps a lot here, but suppose that I want to also allow
 TemplateHaskell, GeneralizedNewtypeDeriving and stuff like that,
 because a lot of real code uses those. They only seem to be restricted
 to prevent cheeky messing with APIs in ways the authors of the APIs
 didn't want -- but that shouldn't necessarily be a security—in terms
 of my system—problem, should it? Ideally I'd very strictly whitelist
 which modules are allowed to be used (e.g. a version of TH that
 doesn't have runIO), and extensions, and then compile any code that
 uses them.

 I'd rather not have to setup a VM just to compile Haskell code safely.
 I'm willing to put some time in to investigate it, but if there's
 already previous work done for this, I'd appreciate any links.

 At the end of the day, there's always just supporting a subset of
 Haskell using SafeHaskell. I'm just curious about the more general
 case, for use-cases similar to my own.
 ___
 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] Compiling arbitrary Haskell code

2013-10-11 Thread Christopher Done
On 12 October 2013 01:19, Johan Tibell johan.tib...@gmail.com wrote:
 Whatever guarantees GHC offers (e.g. using Safe Haskell), I would always run
 things like these in a sandbox. It's much better for security to dissallow
 everything and then whitelist some things (e.g. let the sandbox communicate
 with the rest of the world in some limited way) than the other way around.

Yeah, the impression I'm getting is that compiling pretty much
anything other than simple expressions (a la lambdabot) is that all
bets are off.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] MonadBaseControl IO instance for conduits ?

2013-10-11 Thread John Wiegley
 Aleksey Uymanov s9gf4...@gmail.com writes:

 Is it posible to create instance of MonadBaseControl IO (ConduitM i o m) ?

No, it is not, for approximately the same reason that you cannot create one
for ContT (or any form of continuation).

-- 
John Wiegley
FP Complete Haskell tools, training and consulting
http://fpcomplete.com   johnw on #haskell/irc.freenode.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Call to Action - Fay FFI Bindings for AngularJS

2013-10-10 Thread Adam Bergmark
I've talked to a lot of people that would like to be able to use
Fay with AngularJS, this seems like a great idea! I don't use
AngularJS personally, but I would be happy to help out with
designing it and making code reviews.

Has anyone started working on this already, and do you have any
code/thoughts to share as a starting point?


I created a stub repository under the faylang org on github:

https://github.com/faylang/fay-angular


I'll give anyone who wants to work on this push access, just send
me an e-mail with your github account name, you can also create
pull requests if you want a more in depth code review.

Feel free to open up an issue if you have anything you would like to
discuss.

https://github.com/faylang/fay-angular/issues

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


Re: [Haskell-cafe] hdbc-odbc not getting any data using mssql stored procedure

2013-10-10 Thread Gauthier Segay
Hello Grant, pulling this topic out of the archive as I face similar issue 
and found a work around.

I'm unsure what's happening in gp_somestoredproc but if using the sql 
management studio, you see some output such as

(X row(s) affected)

then you might want to put set nocount on before issuing the statement

I'm unsure what's the status of multiple resultset in hdbc / hdbc-odbc but 
I did succeed pulling results out of first resultset of a stored procedure 
call

(sorry for html email, sending this from google groups)

On Friday, 1 February 2013 01:16:38 UTC+1, grant wrote:

 Hi, 

 I am trying to call a stored procedure (exec gp_somestoredproc 123,22) 
 using microsoft sql server 2008 R2 using hdbc-odbc. 
   
 Here is the haskell code: 

 import Database.HDBC 
 import Database.HDBC.ODBC 
 import Control.Monad 
 import Data.Maybe 
 import qualified Data.ByteString.Char8 as B 

 test1 = do 
   c - connectODBC Driver={SQL Server};Server=?;Database=?;uid=sa;pwd=?; 
   p - prepare c exec gp_somestoredproc 123,22 -- returns no data 
  --  p - prepare c exec [sys].sp_datatype_info_100 0,@ODBCVer=4;exec 
 gp_somestoredproc 123,22 -- all is good 
   e - execute p []  -- returns 6 (number of rows) 
   putStrLn $ execute  ++ show e 
   r - fetchAllRows' p 
   putStrLn $ fetchAllRows'  ++ show r 


 The problem is that this code returns the number of rows correctly but 
 doesn't return data nor are there any errors. 

 However, I ran a perl program using perl dbi and got the data correctly. 

 Here is the perl code: 

 #!/usr/bin/perl 
 use DBI; 

   my $user = 'sa'; 
   my $pw = ''; 
   my $dsn = ''; 
   my $dbh = DBI-connect(dbi:ODBC:$dsn, $user, $pw, 
{PrintError = 1, RaiseError = 1}); 
   if (!$dbh) { 
  print error: connection: $DBI::err\n$DBI::errstr\n$DBI::state\n; 
   } 
   my $type_info = $dbh-type_info(93); 
   while(my($key, $value) = each(%$type_info)){ 
  print $key = $value\n; 
   }; 
   my $sql = exec gp_somestoredproc 123,22; 
   my $sth = $dbh-prepare($sql);   
   my $r   = $sth-execute; 
   while (my ($db) = $sth-fetchrow_array) { 
  print $db . \n===\n; 

   } 
   $dbh-disconnect if $dbh; 

 I traced both versions and noticed that the perl dbi version first called 
 
exec [sys].sp_datatype_info_100 0,@ODBCVer=4 

 So I prefixed the stored proc call in haskell with exec 
 [sys].sp_datatype_info_100 0,@ODBCVer=4; and it worked fine. 

 In short: 

 FAILS  p - prepare c exec gp_somestoredproc 123,22  -- returns number 
 of rows 
 but no data 

 WORKS  p - prepare c exec [sys].sp_datatype_info_100 0,@ODBCVer=4;exec 
 gp_somestoredproc 123,22 

 I have no idea why this works. 

 sp_datatype_info_100 just dumps out the fields types ... 

 More information: 

 The stored procedure returns data with user defined field types. 
 I have managed to do selects against tables with user defined field types 
 without any problems using hdbc-odbc. 
 I couldn't emulate this error on a local older version of mssql server 
 (Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64)  express) but the 
 perl dbi 
 prefixed the stored procedure call with  exec sp_datatype_info 
 0,@ODBCVer=3 
 I am running this against Microsoft SQL Server 2008 R2 (RTM) - 
 10.50.1797.0 
 (X64)   

 I would appreciate any pointers you can give me. 
 Thanks 
 Grant 



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

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


[Haskell-cafe] Increasing memory use in stream computation

2013-10-10 Thread Arie Peterson
(Sorry for the long email.)

Summary: why does the attached program have non-constant memory use?


 Introduction 

I've written a program to do a big computation. Unfortunately, the computation 
takes a very long time (expectedly), and the memory use increases slowly 
(unexpectedly), until it fills up the entire memory and swap space of the 
computer (many gigabytes).

The rough structure of the program is:

• create a long (up to 20 million) list of objects;
• compute a number for each of those objects;
• compute the sum of the resulting list.

I switched the intermediate data structure from a list to a Stream (from the 
stream-fusion package), hoping to fix the memory issue. It decreased both the 
memory use and the rate of its increase, but after a long time, the program 
still uses up all available memory.

 A simple program

After many hours of cutting down my program, I now have a small program 
(attached) that shows the same behaviour. It uses only said stream-fusion 
package, and vector. (I haven't yet tried to cut out the use of vector. I hope 
it is irrelevant, because all vectors are of fixed small size.)

I compile the program with ghc-7.6.1 using

 ghc --make -threaded -rtsopts -with-rtsopts=-M1G -K128M -O2 -main-is
   Test.main Test

The rts options may not be strictly necessary: I added them at some point to 
allow the use of multiple cores, and to prevent the program from crashing the 
machine by using all available memory.

When running the program, the resident memory quickly grows to about 3.5 MB 
(which I am fine with); this stays constant for a long time, but after about 7 
minutes, it starts to grow further. The growth is slow, but I really would 
hope this program to run in constant memory.

 The code 

Note that I added an instance for Monad Stream, using concatMap. This is 
implicitly used in the definition of the big stream.

The source of Data.Stream contains many alternative implementations of concat 
and concatMap, and alludes to the difficulty of making it fuse properly. Could 
it be that the fusion did not succeed in this case?


Thanks for any help!

Regards,

Arie
module Test where


import   Control.Applicative (($))
import qualified Data.Stream as S
import   Data.Stream (Stream)
import qualified Data.Vector as V


-- Vector stuff

type V = V.Vector Integer

-- Inner product.
inp :: V - V - Integer
inp a b = V.foldl' (+) 0 (V.zipWith (*) a b)

-- Stream stuff

instance Monad Stream where
  return = S.stream . return
  (=) = flip S.concatMap

-- Generating vectors

small :: Stream V
small = go [] 8 where
  go :: [Integer] - Integer - Stream V
  go xs 1 = return $ V.fromList xs
  go xs n = do
x - S.stream [-1,0,0,1]
go (x : xs) (n - 1)

big :: Stream (V,V)
big = do
  v - small
  w - small
  return (v,w)

-- Main program

produce :: Stream Integer
produce = S.filter (== 4) $ uncurry inp $ big

consume :: Stream Integer - Integer
consume = S.foldl' (+) 0

main :: IO ()
main = print (consume produce)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Suppressing HLint on pattern match of files

2013-10-10 Thread Dag Odenhall
Is that actually from HLint though? I think that comes from GHC with
-Walland can be disabled with
-fno-warn-missing-signatures.


On Thu, Oct 10, 2013 at 7:50 AM, Graham Berks gra...@fatlazycat.com wrote:

 Hi, would like to disable 'Top-level binding with no type signature'

 In my test modules that are prefixed with Test.

 Is this possible ??

 Thanks




 ___
 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] hdbc-odbc not getting any data using mssql stored procedure

2013-10-10 Thread grant weyburne
Hi Gauthier, that answer was perfect! I just tried it out and It completely
solved my problem. Thanks so much! Grant.


On Thu, Oct 10, 2013 at 8:58 AM, Gauthier Segay gauthier.se...@gmail.comwrote:

 Hello Grant, pulling this topic out of the archive as I face similar issue
 and found a work around.

 I'm unsure what's happening in gp_somestoredproc but if using the sql
 management studio, you see some output such as

 (X row(s) affected)

 then you might want to put set nocount on before issuing the statement

 I'm unsure what's the status of multiple resultset in hdbc / hdbc-odbc but
 I did succeed pulling results out of first resultset of a stored procedure
 call

 (sorry for html email, sending this from google groups)


 On Friday, 1 February 2013 01:16:38 UTC+1, grant wrote:

 Hi,

 I am trying to call a stored procedure (exec gp_somestoredproc 123,22)
 using microsoft sql server 2008 R2 using hdbc-odbc.

 Here is the haskell code:

 import Database.HDBC
 import Database.HDBC.ODBC
 import Control.Monad
 import Data.Maybe
 import qualified Data.ByteString.Char8 as B

 test1 = do
   c - connectODBC Driver={SQL Server};Server=?;Database=?;**uid=sa;pwd=?;

   p - prepare c exec gp_somestoredproc 123,22 -- returns no data
  --  p - prepare c exec [sys].sp_datatype_info_100 0,@ODBCVer=4;exec
 gp_somestoredproc 123,22 -- all is good
   e - execute p []  -- returns 6 (number of rows)
   putStrLn $ execute  ++ show e
   r - fetchAllRows' p
   putStrLn $ fetchAllRows'  ++ show r


 The problem is that this code returns the number of rows correctly but
 doesn't return data nor are there any errors.

 However, I ran a perl program using perl dbi and got the data correctly.

 Here is the perl code:

 #!/usr/bin/perl
 use DBI;

   my $user = 'sa';
   my $pw = '';
   my $dsn = '';
   my $dbh = DBI-connect(dbi:ODBC:$dsn, $user, $pw,
{PrintError = 1, RaiseError = 1});
   if (!$dbh) {
  print error: connection: $DBI::err\n$DBI::errstr\n$DBI:**:state\n;

   }
   my $type_info = $dbh-type_info(93);
   while(my($key, $value) = each(%$type_info)){
  print $key = $value\n;
   };
   my $sql = exec gp_somestoredproc 123,22;
   my $sth = $dbh-prepare($sql);
   my $r   = $sth-execute;
   while (my ($db) = $sth-fetchrow_array) {
  print $db . \n===\n;

   }
   $dbh-disconnect if $dbh;

 I traced both versions and noticed that the perl dbi version first called

exec [sys].sp_datatype_info_100 0,@ODBCVer=4

 So I prefixed the stored proc call in haskell with exec
 [sys].sp_datatype_info_100 0,@ODBCVer=4; and it worked fine.

 In short:

 FAILS  p - prepare c exec gp_somestoredproc 123,22  -- returns number
 of rows
 but no data

 WORKS  p - prepare c exec [sys].sp_datatype_info_100 0,@ODBCVer=4;exec
 gp_somestoredproc 123,22

 I have no idea why this works.

 sp_datatype_info_100 just dumps out the fields types ...

 More information:

 The stored procedure returns data with user defined field types.
 I have managed to do selects against tables with user defined field types
 without any problems using hdbc-odbc.
 I couldn't emulate this error on a local older version of mssql server
 (Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64)  express) but the
 perl dbi
 prefixed the stored procedure call with  exec sp_datatype_info
 0,@ODBCVer=3
 I am running this against Microsoft SQL Server 2008 R2 (RTM) -
 10.50.1797.0
 (X64)

 I would appreciate any pointers you can give me.
 Thanks
 Grant



 __**_
 Haskell-Cafe mailing list
 haskel...@haskell.org
 http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe


 ___
 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] Increasing memory use in stream computation

2013-10-10 Thread Claude Heiland-Allen
Hi Arie,

On 10/10/13 14:02, Arie Peterson wrote:
 (Sorry for the long email.)
 
 Summary: why does the attached program have non-constant memory use?

Looking at the heap profile graph (generated with +RTS -h, no need to
compile with profiling) I see the increasing memory use is split about
evenly between STACK and BLACKHOLE.  I don't know what that means or why
it occurs, but replacing `small` solved that problem for me:

small = V.fromList $ S.stream (replicateM 7 [-1,0,0,1])

I get the same output 3999744 from your version and my changed version.


Claude



 
 
  Introduction 
 
 I've written a program to do a big computation. Unfortunately, the 
 computation 
 takes a very long time (expectedly), and the memory use increases slowly 
 (unexpectedly), until it fills up the entire memory and swap space of the 
 computer (many gigabytes).
 
 The rough structure of the program is:
 
 • create a long (up to 20 million) list of objects;
 • compute a number for each of those objects;
 • compute the sum of the resulting list.
 
 I switched the intermediate data structure from a list to a Stream (from the 
 stream-fusion package), hoping to fix the memory issue. It decreased both the 
 memory use and the rate of its increase, but after a long time, the program 
 still uses up all available memory.
 
  A simple program
 
 After many hours of cutting down my program, I now have a small program 
 (attached) that shows the same behaviour. It uses only said stream-fusion 
 package, and vector. (I haven't yet tried to cut out the use of vector. I 
 hope 
 it is irrelevant, because all vectors are of fixed small size.)
 
 I compile the program with ghc-7.6.1 using
 
 ghc --make -threaded -rtsopts -with-rtsopts=-M1G -K128M -O2 -main-is
   Test.main Test
 
 The rts options may not be strictly necessary: I added them at some point to 
 allow the use of multiple cores, and to prevent the program from crashing the 
 machine by using all available memory.
 
 When running the program, the resident memory quickly grows to about 3.5 MB 
 (which I am fine with); this stays constant for a long time, but after about 
 7 
 minutes, it starts to grow further. The growth is slow, but I really would 
 hope this program to run in constant memory.
 
  The code 
 
 Note that I added an instance for Monad Stream, using concatMap. This is 
 implicitly used in the definition of the big stream.
 
 The source of Data.Stream contains many alternative implementations of concat 
 and concatMap, and alludes to the difficulty of making it fuse properly. 
 Could 
 it be that the fusion did not succeed in this case?
 
 
 Thanks for any help!
 
 Regards,
 
 Arie

-- 
http://mathr.co.uk

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


Re: [Haskell-cafe] Suppressing HLint on pattern match of files

2013-10-10 Thread Graham Berks
Ah good point :) Wonder if I can change it on cabal file somehow.

Thanks



On 10 October 2013 at 14:05:45, Dag Odenhall (dag.odenh...@gmail.com) wrote:

Is that actually from HLint though? I think that comes from GHC with  
-Wall and can be disabled with  
-fno-warn-missing-signatures.



On Thu, Oct 10, 2013 at 7:50 AM, Graham Berks gra...@fatlazycat.com wrote:
Hi, would like to disable 'Top-level binding with no type signature'

In my test modules that are prefixed with Test.

Is this possible ??

Thanks




___
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


[Haskell-cafe] Nested monadic monoids via Traversable?

2013-10-10 Thread Hans Höglund
I have been experimenting with compositions of monads carrying associated 
monoids (i.e. Writer-style) and discovered the following pattern:

--
{-# LANGUAGE 
DeriveFunctor,
DeriveFoldable,
DeriveTraversable,
GeneralizedNewtypeDeriving #-}

import Control.Monad
import Control.Monad.Writer hiding (())
import Data.Semigroup
import Data.Foldable (Foldable)
import Data.Traversable (Traversable)
import qualified Data.Traversable as Traversable

newtype Foo m a = Foo (Writer m a)
deriving (Monad, MonadWriter m, Functor, Foldable, Traversable)

newtype Bar m a = Bar { getBar :: [Foo m a] }
deriving (Semigroup, Functor, Foldable, Traversable)
instance Monoid m = Monad (Bar m) where
return = Bar . return . return
Bar ns = f = Bar $ ns = joinedSeq . fmap (getBar . f)
where
joinedSeq = fmap join . Traversable.sequence

runFoo (Foo x) = runWriter x
runBar (Bar xs) = fmap runFoo xs
--

That is, given a type that is Monadic and Traversable, we can define a list of 
the same type as a monad, whose binding action glues together the nested 
Monoid values. A trivial example:

--
-- annotate all elements in bar
tells :: String - Bar String a - Bar String a
tells a (Bar xs) = Bar $ fmap (tell a ) xs

-- a bar with no annotations
x :: Bar String Int
x = return 0

-- annotations compose with =
y :: Bar String Int
y = x  tells a x = (tells b . return)

-- and with join
z :: Bar String Int
z = join $ tells d $ return (tells c (return 0)  return 1)

-- runBar y == [(0,b),(0,ab)]
-- runBar z == [(0,dc),(1,d)]
--

However, I am concerned about the (Monad Bar) instance which seems ad-hoc to 
me, especially the use of sequence. Is there a more general pattern which uses 
a class other than Traversable? Any pointers would be much appreciated.

Regards,
Hans


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


Re: [Haskell-cafe] Increasing memory use in stream computation

2013-10-10 Thread Bertram Felgenhauer
Arie Peterson wrote:
 (Sorry for the long email.)
 
 Summary: why does the attached program have non-constant memory use?

Unfortunately, I don't know. I'll intersperse some remarks and
propose an alternative to stream fusion at the end, which allows
your test program to run in constant space.

  A simple program
 
 When running the program, the resident memory quickly grows to about 3.5 MB 
 (which I am fine with); this stays constant for a long time, but after about 
 7 
 minutes, it starts to grow further. The growth is slow, but I really would 
 hope this program to run in constant memory.

A quicker way to spot the increased memory usage is to look at GC
statistics. I used

 ./Test +RTS -Sstderr 21 | grep 'Gen:  1'
   569904  8192 65488  0.00  0.000.010.0100  (Gen:  1)
   516520  9768 67080  0.00  0.004.234.2300  (Gen:  1)
   513824 14136 71448  0.00  0.008.438.4400  (Gen:  1)
   515856 16728 74040  0.00  0.00   12.70   12.7500  (Gen:  1)
   515416 19080 76392  0.00  0.00   17.01   17.1100  (Gen:  1)
   515856 22248 79560  0.00  0.00   21.33   21.4800  (Gen:  1)
   514936 25080 82392  0.00  0.00   25.65   25.8400  (Gen:  1)
   514936 28632 85944  0.00  0.00   29.94   30.1600  (Gen:  1)
   513512 32328 89640  0.00  0.00   34.24   34.4800  (Gen:  1)
   515224 37032127112  0.00  0.00   38.35   38.6200  (Gen:  1)

Note the increasing values in the third column; that's the live bytes
after each major GC.

  The code 
 
 Note that I added an instance for Monad Stream, using concatMap. This is 
 implicitly used in the definition of the big stream.
 
 The source of Data.Stream contains many alternative implementations of concat 
 and concatMap, and alludes to the difficulty of making it fuse properly. 
 Could 
 it be that the fusion did not succeed in this case?

I had a glimpse at the core code generated by ghc, but the amount of
code is overwhelming. From reading the source code, and as far as my
intuition goes, the code *should* run in constant space.

As an experiment, I rewrote the code using difference lists, and the
result ran in constant memory. I then tried to abstract this idea into
a nice data type. (I lost the low-level difference list code on the way,
but the code was quite hard to read anyway.)

I ended up with an odd mixture of a difference lists and a continuation
that should be applied to each element:

data Stream a where
Stream :: (forall r. (a - r) - [r] - [r]) - Stream a

with  Stream s  representing the list  s id []. The motivation for the
(a - r) argument is that it makes fmap trivial:

fmap f (Stream s) = Stream (\g - s (g . f))

I'll attach the full code below (it's a separate module, Stream.hs
that can be imported instead of Data.Stream for your small example.)
With that replacement, the code runs in constant space and becomes
about 3x faster. Using the 'singleton' function for 'return' results
in an additional, but very modest (about 10%) speedup.

I wonder whether that approach scales up to your real code.

Enjoy,

Bertram
{-# LANGUAGE GADTs, Rank2Types #-}

-- A difference list based implementation of a small part of the
-- Data.Stream interface from the stream-fusion package.

module Stream where

import Prelude hiding (concatMap)
import qualified Data.List as List

data Stream a where
Stream :: { unStream :: forall r. (a - r) - [r] - [r] } - Stream a

empty :: Stream a
empty = Stream (\_ - id)

singleton :: a - Stream a
singleton x = Stream (\f - (f x :))

fromList :: [a] - Stream a
fromList xs = Stream (\f zs - foldr (\x xs - f x : xs) zs xs)

toList :: Stream a - [a]
toList (Stream s) = s id []

instance Functor Stream where
fmap f (Stream s) = Stream (\g - s (g . f))

concatMap :: (a - Stream b) - Stream a - Stream b
concatMap f g = Stream $ \h zs - foldr (\x - unStream (f x) h) zs (toList g)

filter :: (a - Bool) - Stream a - Stream a
filter p = concatMap (\x - if p x then singleton x else empty)

stream :: [a] - Stream a
stream = fromList

foldl' :: (a - b - a) - a - Stream b - a
foldl' f i s = List.foldl' f i (toList s)



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


Re: [Haskell-cafe] Increasing memory use in stream computation

2013-10-10 Thread Arie Peterson
Hi Claude,


 Looking at the heap profile graph (generated with +RTS -h, no need to
 compile with profiling) I see the increasing memory use is split about
 evenly between STACK and BLACKHOLE.  I don't know what that means or why
 it occurs, but replacing `small` solved that problem for me:
 
 small = V.fromList $ S.stream (replicateM 7 [-1,0,0,1])

Interesting!

Unfortunately, my real code is more complicated, and I can't simplify its 
small function in this way. (The list [-1,0,0,1], that is being streamed in 
the do block, in the full program depends on some parameter that changes on 
each iteration.)

Although, maybe I can do all the logic of the small function in the list 
monad, and stream the resulting list, as you do in the above.

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


Re: [Haskell-cafe] Increasing memory use in stream computation

2013-10-10 Thread Arie Peterson
Hi Bertram,


 Unfortunately, I don't know. I'll intersperse some remarks and
 propose an alternative to stream fusion at the end, which allows
 your test program to run in constant space.
 
 
 A quicker way to spot the increased memory usage is to look at GC
 statistics. I used
 
  ./Test +RTS -Sstderr 21 | grep 'Gen:  1'
 
 […]

Thanks for the suggestion.

 I had a glimpse at the core code generated by ghc, but the amount of
 code is overwhelming. From reading the source code, and as far as my
 intuition goes, the code *should* run in constant space.

Yes, my intuition says the same. For me though, this is only based on an 
informal imperative interpretation of the code, not on any understanding of 
the Stream internals.

 As an experiment, I rewrote the code using difference lists, and the
 result ran in constant memory. I then tried to abstract this idea into
 a nice data type. (I lost the low-level difference list code on the way,
 but the code was quite hard to read anyway.)
 […] 
 I'll attach the full code below (it's a separate module, Stream.hs
 that can be imported instead of Data.Stream for your small example.)
 With that replacement, the code runs in constant space and becomes
 about 3x faster. Using the 'singleton' function for 'return' results
 in an additional, but very modest (about 10%) speedup.
 
 I wonder whether that approach scales up to your real code.

Awesome, thanks for all this work!

Unfortunately, the modified full program does not use constant memory. I 
replaced Data.Stream by your Stream, and added one more function append to 
it (which was very natural, given the difference list nature). This version 
increases its resident size by about 1MB after roughly 10 minutes, and then 
again after another 10 minutes.

This makes it a significant improvement over Data.Stream, memory-wise, but I'm 
not sure if it will be enough to perform the entire computation without 
running out of memory.

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


Re: [Haskell-cafe] Using Quick Check generators for getting arbitrary value streams

2013-10-10 Thread Anton Nikishaev
Luke Evans l...@eversosoft.com writes:

 I was hoping I could use Arbitrary instances to generate streams of
 values for test data.  It looks like you're not 'supposed' to be
 trying this, other than for the specific purpose of then testing some
 properties on these streams within Quick Check itself.

 I'm looking for something like the sample' function in Quick Check,
 only to produce an infinite stream of values (rather than the 11
 values that are clearly designed simply to give you a sense of the
 output of a generator).
 Am I out of luck, or is there yet some cunning way of doing this
 without hacking the Quick Check package to export the MkGen
 constructor?

You can make a generator that itself produces infinite list. There's
ready-made function in Test.QuickCheck.Instances.List for that (package
checkes)


-- 
lelf

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


[Haskell-cafe] Conditional lens

2013-10-10 Thread Artyom Kazak

Hello!

I am working with TypeReps, and while writing some functions I have
noticed that I could use lenses to simplify them; however, I have stumbled
upon some difficulties.

First I’ll try to clarify which functions I want to write:

* a function for converting TypeRep of, say, `Maybe x` to `[x]`
  (for all x). It requires checking if the TyCon is `Maybe` and
  replacing it with []-TyCon. If it wasn’t `Maybe`, I return Nothing.

* a similar function for replacing `Char`s and `Lazy.Text`s to just
  `Text`. Again, if the TypeRep-to-be-replaced doesn’t satisfy my
  conditions, I return Nothing.

These two functions (and some others, I suppose) can be written concisely
with the help of one combinator. I don’t know how to write it as
a composable Lens, so I’ll give it here as an ad-hoc Lens-modifying
function instead:

ifL :: (a - Bool) - Lens s t a b - Lens s (Maybe t) (Maybe a) b
ifL p l = lens getter setter
  where
get s = getConst $ l Const s
getter s   = let a = get s
 in  if p a then Just a else Nothing
setter s b = let a = get s
 in  if p a then Just (set l b s) else Nothing

It works like this:

 (0, 2)  ifL even fs .~ hello
Just (hello,2)

 (1, 2)  ifL even fs .~ hello
Nothing

With `ifL`, my initial ugly

changeTyCon :: TyCon - TyCon - TypeRep - Maybe TypeRep
changeTyCon tc tc' t | t^.tyCon == tc = Just $ t  tyCon .~ tc'
 | otherwise  = Nothing

boils down to

changeTyCon tc tc' = ifL (== tc) tyCon .~ tc'

Why did I call the initial version “ugly”? Well, because

a) it manually handles `Maybe`s, and
b) it has to perform both getting and setting (two passes).

So, my questions are:

1. What would be the idiomatic way to write `ifL`?

2. How can I do something like `t ^. ifL (== tc) tyCon`?
   Currently it doesn’t work because view’s type has been
   simplified in lens-3.9.

3. Perhaps it would be better to represent `ifL` as a Traversal
   which simply ignores values that don’t match the condition?
   Then I could (?) use `failover` to do what I want. I searched
   for something filter-like in lens library, but haven’t found
   anything.

4. If I haven’t missed anything and it indeed can’t be done with bare
   lens, would `ifL` or something similar be welcome as an addition
   to the library?

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


Re: [Haskell-cafe] Conditional lens

2013-10-10 Thread Edward Kmett
`ifL` isn't a legal lens for several reasons.

Lens s t a b generally requires that the types a subsumes b and b subsumes
a, and that s subsumes t and t subsumes s.

Lens s (Maybe t) (Maybe a) b is a huge red flag.

There is an 'illegal prism' provided by lens that is a more principled
version of this, however.

 (0,2)  _1.filtered even .~ 2

(2,2)
filtered only claims to be a Fold, because that is all it can legally claim
to pass the laws for, however it is implemented in such a way that you can
use it as a Traversal or even a Prism. To sleep soundly you should ensure
that the elements you write back pass the filter function as True,
otherwise you'll violate a law and the lens police will come for you in the
night.

You can of course implement the method you want without any of these
shenanigans and still sleep well at night, though.

changeTyCon tc tc' = tyCon $ \a - if a == tc then Just tc' else Nothing

changeTyCon tc tc' = tyCon $ \a - tc' $ guard (a == tc)

-Edward



On Thu, Oct 10, 2013 at 5:00 PM, Artyom Kazak y...@artyom.me wrote:

 Hello!

 I am working with TypeReps, and while writing some functions I have
 noticed that I could use lenses to simplify them; however, I have stumbled
 upon some difficulties.

 First I’ll try to clarify which functions I want to write:

 * a function for converting TypeRep of, say, `Maybe x` to `[x]`
   (for all x). It requires checking if the TyCon is `Maybe` and
   replacing it with []-TyCon. If it wasn’t `Maybe`, I return Nothing.

 * a similar function for replacing `Char`s and `Lazy.Text`s to just
   `Text`. Again, if the TypeRep-to-be-replaced doesn’t satisfy my
   conditions, I return Nothing.

 These two functions (and some others, I suppose) can be written concisely
 with the help of one combinator. I don’t know how to write it as
 a composable Lens, so I’ll give it here as an ad-hoc Lens-modifying
 function instead:

 ifL :: (a - Bool) - Lens s t a b - Lens s (Maybe t) (Maybe a) b
 ifL p l = lens getter setter
   where
 get s = getConst $ l Const s
 getter s   = let a = get s
  in  if p a then Just a else Nothing
 setter s b = let a = get s
  in  if p a then Just (set l b s) else Nothing

 It works like this:

  (0, 2)  ifL even fs .~ hello
 Just (hello,2)

  (1, 2)  ifL even fs .~ hello
 Nothing

 With `ifL`, my initial ugly

 changeTyCon :: TyCon - TyCon - TypeRep - Maybe TypeRep
 changeTyCon tc tc' t | t^.tyCon == tc = Just $ t  tyCon .~ tc'
  | otherwise  = Nothing

 boils down to

 changeTyCon tc tc' = ifL (== tc) tyCon .~ tc'

 Why did I call the initial version “ugly”? Well, because

 a) it manually handles `Maybe`s, and
 b) it has to perform both getting and setting (two passes).

 So, my questions are:

 1. What would be the idiomatic way to write `ifL`?

 2. How can I do something like `t ^. ifL (== tc) tyCon`?
Currently it doesn’t work because view’s type has been
simplified in lens-3.9.

 3. Perhaps it would be better to represent `ifL` as a Traversal
which simply ignores values that don’t match the condition?
Then I could (?) use `failover` to do what I want. I searched
for something filter-like in lens library, but haven’t found
anything.

 4. If I haven’t missed anything and it indeed can’t be done with bare
lens, would `ifL` or something similar be welcome as an addition
to the library?

 Thanks!

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


Re: [Haskell-cafe] Interfacing real-time stocks data API

2013-10-09 Thread Alexey Uimanov
I did not find such a library, but I am interested in Haskell trading
automation too.

BTW, I am developing package for testing trading systems, it can just
download historical data from some free russian stock services for now.

https://github.com/s9gf4ult/hadan

If you interested we could join forces.


2013/10/9 Miro Karpis miroslav.kar...@gmail.com

 Please, did/does anybody tried to interface with Haskell some real-time
 stocks data API? If yes, please which one? So far I came down to
 ActveTick,...

 thanks,
 m.

 ___
 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] Interfacing real-time stocks data API

2013-10-09 Thread Alexey Uimanov
Yes, the trading system, or code generator. It depends on what would be
easier to implement. But firstly I need a simulator and history data
crawler what I am working on.


2013/10/9 Miro Karpis miroslav.kar...@gmail.com

 Hi Alexey,
 thank you for response. You wrote that you are developing package for
 testing trading systems. Are you planning to also build a trading system?

 Regards,
 Miro


 On Wed, Oct 9, 2013 at 10:28 AM, Alexey Uimanov s9gf4...@gmail.comwrote:

 I did not find such a library, but I am interested in Haskell trading
 automation too.

 BTW, I am developing package for testing trading systems, it can just
 download historical data from some free russian stock services for now.

 https://github.com/s9gf4ult/hadan

 If you interested we could join forces.


 2013/10/9 Miro Karpis miroslav.kar...@gmail.com

 Please, did/does anybody tried to interface with Haskell some real-time
 stocks data API? If yes, please which one? So far I came down to
 ActveTick,...

 thanks,
 m.

 ___
 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



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


[Haskell-cafe] FP relates events in NYC

2013-10-09 Thread Dan Frumib
Hi folks, I will be visiting New York at the end of the October and I would 
like to catch some cool Haskell events if possible.  

I'll be staying in the city from 29th of October to the 10th of November and I 
would like to plan my trip ahead. 

I am looking for anything nerdy: talks, seminars, user groups, etc

Thanks

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


Re: [Haskell-cafe] Interfacing real-time stocks data API

2013-10-09 Thread David Fox
I would love to see Haskell bindings for this:
https://us.etrade.com/active-trading/api


On Tue, Oct 8, 2013 at 1:26 PM, Miro Karpis miroslav.kar...@gmail.comwrote:

 Please, did/does anybody tried to interface with Haskell some real-time
 stocks data API? If yes, please which one? So far I came down to
 ActveTick,...

 thanks,
 m.

 ___
 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] Interfacing real-time stocks data API

2013-10-09 Thread miroslav . karpis
Yes, I also like that one. Problem is that they give access only to US citizens 
and some limited countries.

m.

-Original Message-
From: David Fox d...@seereason.com
To: miroslav.kar...@gmail.com
Cc: Haskell Cafe haskell-cafe@haskell.org
Sent: Wed, 09 Oct 2013 18:54
Subject: Re: [Haskell-cafe] Interfacing real-time stocks data API

I would love to see Haskell bindings for this:
https://us.etrade.com/active-trading/api


On Tue, Oct 8, 2013 at 1:26 PM, Miro Karpis miroslav.kar...@gmail.comwrote:

 Please, did/does anybody tried to interface with Haskell some real-time
 stocks data API? If yes, please which one? So far I came down to
 ActveTick,...

 thanks,
 m.

 ___
 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] Interfacing real-time stocks data API

2013-10-09 Thread Yuri de Wit
There is also Interactive Brokers API, which used to be a lower cost
alternative.


On Wed, Oct 9, 2013 at 1:57 PM, miroslav.kar...@gmail.com wrote:

 Yes, I also like that one. Problem is that they give access only to US
 citizens and some limited countries.

 m.


 -Original Message-
 From: David Fox d...@seereason.com
 To: miroslav.kar...@gmail.com
 Cc: Haskell Cafe haskell-cafe@haskell.org
 Sent: Wed, 09 Oct 2013 18:54
 Subject: Re: [Haskell-cafe] Interfacing real-time stocks data API

 I would love to see Haskell bindings for this:
 https://us.etrade.com/active-trading/api


 On Tue, Oct 8, 2013 at 1:26 PM, Miro Karpis miroslav.kar...@gmail.comwrote:

 Please, did/does anybody tried to interface with Haskell some real-time
 stocks data API? If yes, please which one? So far I came down to
 ActveTick,...

 thanks,
 m.

 ___
 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


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


[Haskell-cafe] Fwd: [Haskell-beginners] RankNTypes + ConstraintKinds to use Either as a union

2013-10-09 Thread Thiago Negri
(from thread:
http://www.haskell.org/pipermail/beginners/2013-October/012703.html)

Why type inference can't resolve this code?

 {-# LANGUAGE RankNTypes, ConstraintKinds #-}

 bar :: (Num a, Num b) = (forall c. Num c = c - c) - Either a b -
Either a b
 bar f (Left a) = Left (f a)
 bar f (Right b) = Right (f b)

 bar' = bar (+ 2) -- This compiles ok

 foo :: (tc a, tc b) = (forall c. tc c = c - c) - Either a b - Either
a b
 foo f (Left a) = Left (f a)
 foo f (Right b) = Right (f b)

 foo' = foo (+ 2) -- This doesn't compile because foo' does not typecheck

 -- Kim-Ee pointed out that this works:
 type F tc a b =  (tc a, tc b) = (forall c. tc c = c - c) - Either a b
- Either a b
 foo' = (foo :: F Num a b) (+2)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Case studies, step two

2013-10-09 Thread Mike Meyer
I want to thank everyone who provided pointers for the last question about
this. They were a big help.  We're now trying to narrow things down a bit.

If you have either converted part of a business project from a language
like ruby or python to Haskell, or have a business project that integrates
Haskell with such a language and are willing to take a short survey about
it, could you get back to me?

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


Re: [Haskell-cafe] Interfacing real-time stocks data API

2013-10-09 Thread David Johnson
IB is not real-time though.


On Wed, Oct 9, 2013 at 12:48 PM, Yuri de Wit yde...@gmail.com wrote:

 There is also Interactive Brokers API, which used to be a lower cost
 alternative.


 On Wed, Oct 9, 2013 at 1:57 PM, miroslav.kar...@gmail.com wrote:

 Yes, I also like that one. Problem is that they give access only to US
 citizens and some limited countries.

 m.


 -Original Message-
 From: David Fox d...@seereason.com
 To: miroslav.kar...@gmail.com
 Cc: Haskell Cafe haskell-cafe@haskell.org
 Sent: Wed, 09 Oct 2013 18:54
 Subject: Re: [Haskell-cafe] Interfacing real-time stocks data API

  I would love to see Haskell bindings for this:
 https://us.etrade.com/active-trading/api


 On Tue, Oct 8, 2013 at 1:26 PM, Miro Karpis miroslav.kar...@gmail.comwrote:

 Please, did/does anybody tried to interface with Haskell some real-time
 stocks data API? If yes, please which one? So far I came down to
 ActveTick,...

 thanks,
 m.

 ___
 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



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




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


[Haskell-cafe] RankNTypes + ConstraintKinds to use Either as a union

2013-10-09 Thread oleg

Thiago Negri wrote:
 Why type inference can't resolve this code?

 {-# LANGUAGE RankNTypes, ConstraintKinds #-}

 bar :: (Num a, Num b) = (forall c. Num c = c - c) -Either a b -Either a b
 bar f (Left a) = Left (f a)
 bar f (Right b) = Right (f b)

 bar' = bar (+ 2) -- This compiles ok

 foo :: (tc a, tc b) = (forall c. tc c = c - c) - Either a b - Either a b
 foo f (Left a) = Left (f a)
 foo f (Right b) = Right (f b)

 foo' = foo (+ 2) -- This doesn't compile because foo' does not typecheck

The type inference of the constraint fails because it is
ambiguous. Observe that not only bar (+2) compiles OK, but also
bar id. The function id :: c - c has no constraints attached, but
still fits for (forall c. Num c = c - c). 

Let's look at the problematic foo'. What constraint would you think
GHC should infer for tc? Num? Why not the composition of Num and Read,
or Num and Show, or Num and any other set of constraints? Or perhaps
Fractional (because Fractional implies Num)? For
constraints, we get the implicit subtyping (a term well-typed with
constraints C is also well-typed with any bigger constraint set C',
or any constraint set C'' which implies C).
Synonyms and superclass constraints break the principal types. 
So, inference is hopeless.

We got to help the type inference and tell which constraint we want.
For example,

 newtype C ctx = C (forall c. ctx c = c - c)

 foo :: (ctx a, ctx b) = C ctx - (forall c. ctx c = c - c) - 
Either a b - Either a b
 foo _ f (Left a) = Left (f a)
 foo _ f (Right b) = Right (f b)

 foo' = foo (undefined :: C Num) (+2)

Or, better

 xyz :: (ctx a, ctx b) = C ctx - Either a b - Either a b
 xyz (C f) (Left a) = Left (f a)
 xyz (C f) (Right b) = Right (f b)

 xyz' = xyz ((C (+2)) :: C Num)
 xyz'' = xyz ((C (+2)) :: C Fractional)

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


[Haskell-cafe] Suppressing HLint on pattern match of files

2013-10-09 Thread Graham Berks
Hi, would like to disable 'Top-level binding with no type signature'

In my test modules that are prefixed with Test.

Is this possible ??

Thanks



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


Re: [Haskell-cafe] ANN: E-book version of the Typeclassopedia

2013-10-08 Thread Alfredo Di Napoli
Thanks, I wanted this for a long time as well!

A.


On 5 October 2013 17:25, Flavio Villanustre fvillanus...@gmail.com wrote:

 Very useful, thanks!
 On Oct 4, 2013 9:13 AM, Erlend Hamberg ehamb...@gmail.com wrote:

 While re-reading Brent Yorgey's Excellent Typeclassopedia I converted it
 to Pandoc Markdown in order to be able to create an EPUB version. Having
 a “real” e-book meant that I could comfortably read it on my e-book
 reader and highlight text and take notes while reading. I also fixed
 some minor issues while reading it. (These fixes were of course
 backported to the official Typeclassopedia version on the Haskell Wiki.)

 The EPUB file can be downloaded from Github:

 https://github.com/ehamberg/typeclassopedia-md/releases

 The Markdown source is also available in that repo and you can of course
 use Pandoc to convert the Markdown file to all the other output formats
 Pandoc supports.

 By using a program like Calibre, the EPUB file can be converted to other
 e-book formats such as the Kindle format.

 I hope people find this useful. :-)

 --
 Erlend Hamberg
 ehamb...@gmail.com

 ___
 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


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


[Haskell-cafe] Interfacing real-time stocks data API

2013-10-08 Thread Miro Karpis
Please, did/does anybody tried to interface with Haskell some real-time
stocks data API? If yes, please which one? So far I came down to
ActveTick,...

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


[Haskell-cafe] ANN: hsqml-0.2.0.0

2013-10-08 Thread Robin KAY

Dear All,

I would like to announce version 0.2.0.0 of the HsQML graphics library.

HsQML provides a Haskell binding to the Qt Quick framework. It allows 
you to write graphical applications where the front-end is written in Qt 
Quick's QML language (incorporating JavaScript) and the back-end is 
written in Haskell. The two layers are coupled together via a facility 
to define custom JavaScript objects through which QML code can call into 
Haskell and vice versa.


HsQML requires an installation of Qt 4.7 or 4.8 (including 
QtDeclarative) present on your path.


This release introduces several new features, including support for 
firing QML signals from Haskell code and MacOS support. A number of bugs 
have also been resolved. For more information, please see my web site 
[1] and the Hackage page [2].


The hsqml-morris demo application [3], which implements the game of Nine 
Men's Morris against an AI opponent, has also been updated to 0.2.0.0. 
It now uses QML signals to run the game's AI processing outside of the 
event loop so as to maintain a responsive UI.


My goals for the next release are to work on writing a proper user 
manual and to migrate the library over to work with Qt 5.x.


[1] http://www.gekkou.co.uk/software/hsqml
[2] http://hackage.haskell.org/package/hsqml-0.2.0.0
[3] http://hackage.haskell.org/package/hsqml-morris-0.2.0.0

Regards,

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


Re: [Haskell-cafe] Using Quick Check generators for getting arbitrary value streams

2013-10-08 Thread adam vogt
Hi Luke,

It seems like you missed this module:
http://hackage.haskell.org/package/QuickCheck-2.6/docs/Test-QuickCheck-Gen.html

Adam

On Mon, Oct 7, 2013 at 7:21 PM, Luke Evans l...@eversosoft.com wrote:
 I was hoping I could use Arbitrary instances to generate streams of values 
 for test data.
 It looks like you're not 'supposed' to be trying this, other than for the 
 specific purpose of then testing some properties on these streams within 
 Quick Check itself.

 I'm looking for something like the sample' function in Quick Check, only to 
 produce an infinite stream of values (rather than the 11 values that are 
 clearly designed simply to give you a sense of the output of a generator).
 Am I out of luck, or is there yet some cunning way of doing this without 
 hacking the Quick Check package to export the MkGen constructor?

 -- Luke

 ___
 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


[Haskell-cafe] Lenses that work with Arrows

2013-10-07 Thread Tom Ellis
Dear all,

I introduce a very simple extension to the Lens datatype from Control.Lens
that allows it to work with Arrows:

https://gist.github.com/tomjaguarpaw/6865080

I would particularly like to discuss this with authors of Control.Lens to
see if such an idea is suitable for inclusion in their library.

I have also started a Reddit discussion here:


http://www.reddit.com/r/haskell/comments/1nwetz/lenses_that_work_with_arrows/

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


Re: [Haskell-cafe] A question regarding reading CPP definitions from a C header

2013-10-07 Thread Malcolm Wallace
If you use cpphs as a library, there is an API called runCpphsReturningSymTab.  
Thence you can throw away the actual pre-preprocessed result text, keep only 
the symbol table, and lookup whatever macros you wish to find their values.  I 
suggest you make this into a little code-generator, to produce a Haskell module 
containing the values you need.

On 5 Oct 2013, at 21:37, Ömer Sinan Ağacan wrote:

 Hi all,
 
 Let's say I want to #include a C header file in my Haskell library
 just to read some macro definitions. The C header file also contains
 some C code. Is there a way to load only macro definitions and not C
 code in #include declarations in Haskell?
 
 What I'm trying to do is I'm linking my library against this C library
 but I want to support different versions of this C library, so I want
 to read it's version from one of it's header files. The problem is the
 header file contains some C code and makes my Haskell source code
 mixed with C source before compilation.
 
 Any suggestions would be appreciated,

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


[Haskell-cafe] typeclass to select a list element

2013-10-07 Thread Paolino
Hello, I'm trying to use a type class to select an element from a list.
I would like to have a String CC as a value for l10'.


{-# LANGUAGE MultiParamTypeClasses, GADTs,FlexibleInstances,  DataKinds
,TypeFamilies, KindSignatures, FlexibleContexts, OverlappingInstances,
StandaloneDeriving, UndecidableInstances #-}



import Data.Nat
import Data.Monoid

data family X (n::Nat) :: *

data L (n::Nat) where
Q :: (Monoid (X n), Show (X n)) = L (Succ n) - X n - L n
E :: Monoid (X n) = L n

deriving instance Show (L n)
data instance X n = String String

instance Monoid (X n) where
String x `mappend` String y = String $ x `mappend` y
mempty = String 
deriving instance Show (X n)

class Compose n n' where
compose :: L n  - L n  - X n'

instance Compose n n where
compose (Q _ x) (Q _ y) = x `mappend` y
compose _ _ = mempty

instance Compose n n' where
compose (Q x _) (Q y _) = compose x y
compose _ _ = mempty

l0 :: L Zero
l0 = Q (Q E $ String C) $ String A

l0' :: L Zero
l0' = Q (Q E $ String C) $ String B


l10' :: X (Succ Zero)
l10' = compose l0 l0'

l00' :: X Zero
l00' = compose l0 l0'
{-

*Main l00'
String AB
*Main l10'
String 

-}

Thanks for help.

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


Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-07 Thread Daniil Frumin
Isn't it the case that there could be more than one natural transformation
between functors?


On Tue, Oct 1, 2013 at 10:00 PM, John Wiegley jo...@fpcomplete.com wrote:

  Yitzchak Gale g...@sefer.org writes:

  In fact, it even makes sense to define it as FunctorIO, with the only
 laws
  being that liftIO commutes with fmap and preserves id, i.e., that it is a
  natural transformation. (Those laws are also needed for ApplicativeIO and
  MonadIO.)

 Given that we are moving toward Applicative (and thus Functor) as a
 superclass
 of Monad, why not just solve the MonadIO problem and similar type classes
 with
 natural transformations?  It requires 3 extensions, but these are
 extensions I
 believe should become part of Haskell anyway:

 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# LANGUAGE RankNTypes #-}

 module NatTrans where

 import Control.Monad.IO.Class
 import Control.Monad.Trans.Maybe

 class (Functor s, Functor t) = NatTrans s t where
 nmap :: forall a. s a - t a
 -- Such that: nmap . fmap f = fmap f . nmap

 -- In 7.10, this Functor constraint becomes redundant
 instance (Functor m, MonadIO m) = NatTrans IO m where
 nmap = liftIO

 main :: IO ()
 main = void $ runMaybeT $ nmap $ print (10 :: Int)

 Now if I have a functor of one kind and need another, I reach for nmap in
 the
 same way that I reach for fmap to transform the mapped type.

 --
 John Wiegley
 FP Complete Haskell tools, training and consulting
 http://fpcomplete.com   johnw on #haskell/irc.freenode.net
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




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


Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-07 Thread Tom Ellis
On Mon, Oct 07, 2013 at 07:57:23PM +0400, Daniil Frumin wrote:
 Isn't it the case that there could be more than one natural transformation
 between functors?

Definitely.  In addition rwbarton responded to my challenge by finding two
different applicative morphisms between the same applicative, one which
extends to a monad morphism and one which does not:


http://www.reddit.com/r/haskell/comments/1ni8r6/should_it_be_monadio_applicativeio_functorio_or/ccjodj5

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


Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-07 Thread John Wiegley
 Daniil Frumin difru...@gmail.com writes:

 Isn't it the case that there could be more than one natural transformation
 between functors?

Yes, I imagine there would have to be some newtype wrappers to distinguish in
those cases.

-- 
John Wiegley
FP Complete Haskell tools, training and consulting
http://fpcomplete.com   johnw on #haskell/irc.freenode.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Lenses that work with Arrows

2013-10-07 Thread Niklas Haas
On Mon, 7 Oct 2013 10:40:13 +0100, Tom Ellis 
tom-lists-haskell-cafe-2...@jaguarpaw.co.uk wrote:
 Dear all,
 
 I introduce a very simple extension to the Lens datatype from Control.Lens
 that allows it to work with Arrows:
 
 https://gist.github.com/tomjaguarpaw/6865080
 
 I would particularly like to discuss this with authors of Control.Lens to
 see if such an idea is suitable for inclusion in their library.
 
 I have also started a Reddit discussion here:
 
 
 http://www.reddit.com/r/haskell/comments/1nwetz/lenses_that_work_with_arrows/
 
 Tom
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

The reason we don't tend to have combinators like ‘view’ or ‘over’
generalized in their return profunctor like that is because you very
quickly run into type ambiguity issues.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Lenses that work with Arrows

2013-10-07 Thread Tom Ellis
On Mon, Oct 07, 2013 at 07:14:44PM +0200, Niklas Haas wrote:
 On Mon, 7 Oct 2013 10:40:13 +0100, Tom Ellis 
 tom-lists-haskell-cafe-2...@jaguarpaw.co.uk wrote:
  I introduce a very simple extension to the Lens datatype from Control.Lens
  that allows it to work with Arrows:
  
  https://gist.github.com/tomjaguarpaw/6865080
 
 The reason we don't tend to have combinators like ‘view’ or ‘over’
 generalized in their return profunctor like that is because you very
 quickly run into type ambiguity issues.

Perhaps I didn't explain clearly what I am asking for.  The crux of the
issue is whether it is possible *at all* to write the function

overArr :: Arrow arr = Lens s t a b - arr a b - arr s t

not whether it should be merged with over.

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


Re: [Haskell-cafe] Lenses that work with Arrows

2013-10-07 Thread Tom Ellis
On Mon, Oct 07, 2013 at 06:22:33PM +0100, Tom Ellis wrote:
 On Mon, Oct 07, 2013 at 07:14:44PM +0200, Niklas Haas wrote:
  On Mon, 7 Oct 2013 10:40:13 +0100, Tom Ellis 
  tom-lists-haskell-cafe-2...@jaguarpaw.co.uk wrote:
   I introduce a very simple extension to the Lens datatype from Control.Lens
   that allows it to work with Arrows:
   
   https://gist.github.com/tomjaguarpaw/6865080
  
  The reason we don't tend to have combinators like ‘view’ or ‘over’
  generalized in their return profunctor like that is because you very
  quickly run into type ambiguity issues.
 
 Perhaps I didn't explain clearly what I am asking for.  The crux of the
 issue is whether it is possible *at all* to write the function
 
 overArr :: Arrow arr = Lens s t a b - arr a b - arr s t
 
 not whether it should be merged with over.

Edward Kmett has answered in the affirmative, which pleases me greatly!


http://www.reddit.com/r/haskell/comments/1nwetz/lenses_that_work_with_arrows/ccmtfkj
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A question regarding reading CPP definitions from a C header

2013-10-07 Thread Ömer Sinan Ağacan
Thanks for your answer, looks like this is my only option to do this.

Can you provide some information about what does parameters of
runCpphsReturningSymTab stands for? I made several attempts but
couldn't get any useful return value.

For example, I have no idea what does third parameter does. Also,
second parameter.

Thanks,

---
Ömer Sinan Ağacan
http://osa1.net


2013/10/7 Malcolm Wallace malcolm.wall...@me.com:
 If you use cpphs as a library, there is an API called 
 runCpphsReturningSymTab.  Thence you can throw away the actual 
 pre-preprocessed result text, keep only the symbol table, and lookup whatever 
 macros you wish to find their values.  I suggest you make this into a little 
 code-generator, to produce a Haskell module containing the values you need.

 On 5 Oct 2013, at 21:37, Ömer Sinan Ağacan wrote:

 Hi all,

 Let's say I want to #include a C header file in my Haskell library
 just to read some macro definitions. The C header file also contains
 some C code. Is there a way to load only macro definitions and not C
 code in #include declarations in Haskell?

 What I'm trying to do is I'm linking my library against this C library
 but I want to support different versions of this C library, so I want
 to read it's version from one of it's header files. The problem is the
 header file contains some C code and makes my Haskell source code
 mixed with C source before compilation.

 Any suggestions would be appreciated,

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


Re: [Haskell-cafe] A question regarding reading CPP definitions from a C header

2013-10-07 Thread Carl Howells
Have you looked into using hsc2hs? If I understand your problem, it's
designed exactly to solve it.

-- 
Carl


On Mon, Oct 7, 2013 at 12:20 PM, Ömer Sinan Ağacan omeraga...@gmail.comwrote:

 Thanks for your answer, looks like this is my only option to do this.

 Can you provide some information about what does parameters of
 runCpphsReturningSymTab stands for? I made several attempts but
 couldn't get any useful return value.

 For example, I have no idea what does third parameter does. Also,
 second parameter.

 Thanks,

 ---
 Ömer Sinan Ağacan
 http://osa1.net


 2013/10/7 Malcolm Wallace malcolm.wall...@me.com:
  If you use cpphs as a library, there is an API called
 runCpphsReturningSymTab.  Thence you can throw away the actual
 pre-preprocessed result text, keep only the symbol table, and lookup
 whatever macros you wish to find their values.  I suggest you make this
 into a little code-generator, to produce a Haskell module containing the
 values you need.
 
  On 5 Oct 2013, at 21:37, Ömer Sinan Ağacan wrote:
 
  Hi all,
 
  Let's say I want to #include a C header file in my Haskell library
  just to read some macro definitions. The C header file also contains
  some C code. Is there a way to load only macro definitions and not C
  code in #include declarations in Haskell?
 
  What I'm trying to do is I'm linking my library against this C library
  but I want to support different versions of this C library, so I want
  to read it's version from one of it's header files. The problem is the
  header file contains some C code and makes my Haskell source code
  mixed with C source before compilation.
 
  Any suggestions would be appreciated,
 
 ___
 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


[Haskell-cafe] Using Quick Check generators for getting arbitrary value streams

2013-10-07 Thread Luke Evans
I was hoping I could use Arbitrary instances to generate streams of values for 
test data.
It looks like you're not 'supposed' to be trying this, other than for the 
specific purpose of then testing some properties on these streams within Quick 
Check itself.

I'm looking for something like the sample' function in Quick Check, only to 
produce an infinite stream of values (rather than the 11 values that are 
clearly designed simply to give you a sense of the output of a generator).
Am I out of luck, or is there yet some cunning way of doing this without 
hacking the Quick Check package to export the MkGen constructor?

-- Luke

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


Re: [Haskell-cafe] A question regarding reading CPP definitions from a C header

2013-10-07 Thread Ömer Sinan Ağacan
Carl, thank you very much. This is exactly what I was looking for, and
it solved my problem in 5 minutes.

What's awesome is that when Cabal finds a .hsc file it automatically
calls this tool. Great.

Thanks again.

---
Ömer Sinan Ağacan
http://osa1.net


2013/10/8 Carl Howells chowell...@gmail.com:
 Have you looked into using hsc2hs? If I understand your problem, it's
 designed exactly to solve it.

 --
 Carl


 On Mon, Oct 7, 2013 at 12:20 PM, Ömer Sinan Ağacan omeraga...@gmail.com
 wrote:

 Thanks for your answer, looks like this is my only option to do this.

 Can you provide some information about what does parameters of
 runCpphsReturningSymTab stands for? I made several attempts but
 couldn't get any useful return value.

 For example, I have no idea what does third parameter does. Also,
 second parameter.

 Thanks,

 ---
 Ömer Sinan Ağacan
 http://osa1.net


 2013/10/7 Malcolm Wallace malcolm.wall...@me.com:
  If you use cpphs as a library, there is an API called
  runCpphsReturningSymTab.  Thence you can throw away the actual
  pre-preprocessed result text, keep only the symbol table, and lookup
  whatever macros you wish to find their values.  I suggest you make this 
  into
  a little code-generator, to produce a Haskell module containing the values
  you need.
 
  On 5 Oct 2013, at 21:37, Ömer Sinan Ağacan wrote:
 
  Hi all,
 
  Let's say I want to #include a C header file in my Haskell library
  just to read some macro definitions. The C header file also contains
  some C code. Is there a way to load only macro definitions and not C
  code in #include declarations in Haskell?
 
  What I'm trying to do is I'm linking my library against this C library
  but I want to support different versions of this C library, so I want
  to read it's version from one of it's header files. The problem is the
  header file contains some C code and makes my Haskell source code
  mixed with C source before compilation.
 
  Any suggestions would be appreciated,
 
 ___
 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


[Haskell-cafe] POSA

2013-10-07 Thread 山本和彦
Hi all,

Michael Snoyman, Andreas Voellmy and I are invited to write an article
about Warp to The Performance of Open Source Applications:

http://aosabook.org/en/index.html

It is now open to the public including our article.

http://aosabook.org/en/posa/warp.html

Enjoy!

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


Re: [Haskell-cafe] Haskellers in Minsk, Belarus?

2013-10-06 Thread Dmitry Vyal

Hi Yuras,

thanks for the link. That's the sad truth. I don't know the actual 
reasons, but suspect there are many. Overtime work, fatigue, greed and 
alienation which are ubiquitous it today's society are among them. I 
admire people who nevertheless manage to work on open source projects in 
spare time.


But let's return to topic. I'm not a Minsk citizen but I visit it 
regularly. I find it to be very interesting to meet like-minded people 
living in distant (or no so) places. So, in case anybody interested, we 
could schedule a meeting on this November holidays or so.


Best regards,
Dmitry.


Hi,

I just read an article (sorry, it is in russian:
http://habrahabr.ru/post/196454/ ). The idea I found interesting: even
in big citied developers complain that nothing happens at their
location, but when you try to make an event -- only few of them want to
participate.

I never participate in events. What is wrong with me/us?

So, any haskellers in Minsk, Belarus? What about beer, coffee or
co-hacking? I don't have solid idea how to organize an event, but I'm
sure haskellers are interesting people, both personally and
professionally.

Thanks,
Yuras


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


Re: [Haskell-cafe] Poll plea: State of GUI graphics libraries in Haskell

2013-10-06 Thread Heinrich Apfelmus

Sven Panne wrote:

2013/9/27 Conal Elliott co...@conal.net:

[...] Am I mistaken about the current status? I.e., is there a solution for
Haskell GUI  graphics programming that satisfies the properties I'm looking
for (cross-platform, easily buildable, GHCi-friendly, and
OpenGL-compatible)? [...]


Time warp! ;-) Point your browser at the g...@haskell.org archives a
decade ago... I think the consensus at that time was a bit
disappointing: Either one could have something portable but hard to
install and alien-looking, or something non-portable but easy to
install and native-looking. The fundamental UI concepts on the various
platforms differed so much that there was no hope for a grand unified
pretty UI library, so those GUI efforts basically ended. I think the
reasoning behind this hasn't changed recently, but I would love being
proven wrong.


Well, the advent of modern browsers has changed the first alternative to 
portable, easy to install and alien-looking. That's the niche I'm 
belaboring with threepenny-gui.


Personally, I think that the easy to install criterion beats all the 
others -- it is hard to use a GUI library that you can't install.



Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com

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


Re: [Haskell-cafe] Poll plea: State of GUI graphics libraries in Haskell

2013-10-06 Thread Heinrich Apfelmus

Sven Panne wrote:

2013/9/27 Heinrich Apfelmus apfel...@quantentunnel.de:

Actually, I'm reading about WebGL right now, and it appears to me that it
should be very easy to support in Threepenny. [...]


I am not sure if WebGL is enough: WebGL is basically OpenGL ES 2.0,
which is again basically OpenGL 2.0 plus some extensions. OpenGL
itself is currently at 4.4, and the situation regarding the supported
shading language versions is even worse. In a nutshell: WebGL =
ancient OpenGL. If it's enough for your purposes, fine, but otherwise
I guess a lot of people want something more recent.


Fair enough. I have never really worked with OpenGL and its variants, so 
I wouldn't know.


That said, from a cursory look, I get the impression that OpenGL ES 2.0 
was the recent standard on mobile platforms. For instance, iOS 7 just 
recently introduced OpenGL ES 3.0 support.



Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com

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


[Haskell-cafe] Call for Contributions - Haskell Communities and Activities Report, November 2013 edition

2013-10-06 Thread Janis Voigtlaender
 its destination, and not ended up in a spam folder?

A: Prior to publication of the final report, we will send a draft to all
contributors, for possible corrections. So if you do not hear from us
within two weeks after the deadline, it is safer to send another mail
and check whether your first one was received.

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


Re: [Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?

2013-10-06 Thread Ryan Newton
Thanks for the responses all.

I'm afraid the point about GHC.Generics got lost here.  I'll respond and
then rename this as a specific library proposal.

I don't want to fix the world's Eq instances, but I am ok with requiring
that people derive Generic for any data they want to put in an LVar
container.  (From which I can give them a SafeEq instance.)

It's not just LVish that is in this boat any library that tries to
provide deterministic parallelism outside of the IO monad has some very
fine lines to walk.  Take a look at Accelerate.  It is deterministic (as
long as you run only with the CUDA backend and only on one specific GPU...
otherwise fold topologies may look different and non-associative folds may
leak).  Besides, runAcc does a huge amount of implicit IO (writing to
disk, calling nvcc, etc)!  At the very least this could fail if the disk if
full.  But then again, regular pure computations fail when memory runs
out... so I'm ok grouping these in the same bucket for now.  Determinism
modulo available resources.

A possible problem with marking instance Eq as an unsafe feature is that
 many modules would be only Trustworthy instead of Safe.


My proposal is actually more narrow than that.  My proposal is to mark
GHC.Generics as Unsafe.

That way I can define my own SafeEq, and know that someone can't break it
by making a Generic instance that lies.  It is very hard for me to see why
people should be able to make their own Generic instances (that might lie
about the structure of the type), in Safe-Haskell.


 That would go against my every purely functional module is automatically
 safe because the compiler checks that it cannot launch the missiles
 understanding of Safe Haskell.


Heh, that may already be violated by the fact that you can't use other
extensions like OverlappingInstances, or provide your own Typeable
instances.



 Actually, Eq instances are not unsafe per se, but only if I also use some
 other module that assumes certain properties about all Eq instances in
 scope. So in order to check safety, two independent modules (the provider
 and the consumer of the Eq instance) would have to cooperate.


I've found, that this is a very common problem that we have when trying to
make our libraries Safe-Haskell compliant -- often we want to permit and
deny combinations of modules.  I don't have a solution I'm afraid.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?

2013-10-06 Thread Tillmann Rendel

Hi,

Ryan Newton wrote:

It is very hard for me to
see why people should be able to make their own Generic instances (that
might lie about the structure of the type), in Safe-Haskell.


I guess that lying Generics instances might arise because of software 
evolution. Let's say we start with an abstract data type of binary trees.


  module Tree (Tree, node, empty, null, split) where
data Tree a = Node (Tree a) (Tree a) | Empty
  deriving Generics

node = Node

empty = Empty

null Empty = True
null _ = False

split (Node a b) = (a, b)

size Empty = 0
size (Node x y) = size x + size y

Note that this data type is not really abstract, because we export the 
Generics instance, so clients of this module can learn about the 
implementation of Tree. This is not a big deal, because the chosen 
implementation happens to correspond to the abstract structure of binary 
trees anyway. So I would expect that generic code will work fine. For 
example, you could use generic read and show functions to serialize 
trees, and get a reasonable data format.


Now, we want to evolve our module by caching the size of trees. We do 
something like this:


  module Tree (Tree, node, empty, null, split) where
data Tree a = Tree !Int (RealTree a)

data RealTree a = Node (Tree a) (Tree a) | Empty

tree (Node a b) = Tree (size a + size b) t
tree Empty = Tree 0 Empty

node x y = tree (Node x y)

empty = tree Empty

null (Tree _ Empty) = True
null _ = False

split (Tree _ (Node a b)) = (a, b)

size (Tree n _) = n

Except for the Generics instance, we provide the exact same interface 
and behavior to our clients, we just traded some space for performance. 
But what Generics instance should we provide? If we just add deriving 
Generics to the two datatypes, we leak the change of representation to 
our clients. For example, a client that serialized a tree with a generic 
show function based on the old Tree cannot hope to deserialize it back 
with a generic read function based on the new Tree. The size information 
would be missing, and the structure would be different.


If we write a Generics instance by hand, however, I guess we can make it 
present the exact same structure as the derived Generics instance for 
the old Tree. With this lying instance, the generic read function will 
happily deserialize the old data. The size will be computed on the fly, 
because our hand-written Generics instance will introduce calls to our 
smart constructors.


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


[Haskell-cafe] Converting MPTC+fundeps to type family / problem with polymorphic constant. Roles?

2013-10-06 Thread Ryan Newton
The abstract-par class has used multi-parameter type classes with fundeps:


http://hackage.haskell.org/package/abstract-par-0.3.1/docs/Control-Monad-Par-Class.html#g:1

And I'm trying to port it to use type families.  But the following
combination seems to be completely unusable for me right now:

class ParFuture m  = ParIVar m  where
  new  :: forall a . m (Future m a)

You can see the error when you try loading this file at this line:

https://github.com/iu-parfunc/lvars/blob/b60cafb941ea8f2f333ada9b5206cd21211eae26/haskell/par-classes/Control/Par/Class.hs#L159

Future is a type-function from the superclass.  I can't seem to use new
in any way at any type without getting:

Control/Par/Class.hs:161:9:
Could not deduce (Future m a ~ Future m a0)
from the context (ParIVar m, FutContents m a)
  bound by the type signature for
 newFull_ :: (ParIVar m, FutContents m a) = a - m (IVar m
a)
  at Control/Par/Class.hs:151:13-74
NB: `Future' is a type function, and may not be injective
The type variable `a0' is ambiguous
Possible fix: add a type signature that fixes these type variable(s)
Expected type: m (IVar m a)
  Actual type: m (Future m a0)
In the expression: (new :: m (IVar m a))
In a pattern binding: _ = (new :: m (IVar m a))
In an equation for `newFull_':
newFull_ a
  = do { return undefined }
  where
  _ = (new :: m (IVar m a))
Failed, modules loaded: none.

Ok, so it seems like the type of new may just be intrinsically unusable.
 There is no way, by constraining the output of the new function for the
type system to infer what input to the Future type function was.  (Type
function not reversable / injective.)

So am I just stuck?  I don't want a dummy, unused argument just to
communicate the type information to new.  Is this just a place where *MPTC
+ fundeps works but type familes do not?  *Or is there some way that roles
can save the day here?  Do I need to *say that the 'a' parameter has a
representation role*?

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


Re: [Haskell-cafe] Converting MPTC+fundeps to type family / problem with polymorphic constant. Roles?

2013-10-06 Thread Ryan Newton
Oops, right after I sent I realized the answer ;-).  I needed to delete one
character to uncurry the type function.  That is:

   type Future m

instead of

   type Future m a

The fixed version is here:

https://github.com/iu-parfunc/lvars/blob/2b733d3044fde861e9c9b181258e7f9865afa204/haskell/par-classes/Control/Par/Class.hs#L60

I'm still not totally sure what thought process and design guidelines I
should internalize for next time... perhaps: make sure type families have
the minimum number of arguments that they need.

Best,
  -Ryan



On Sun, Oct 6, 2013 at 8:27 PM, Ryan Newton rrnew...@gmail.com wrote:

 The abstract-par class has used multi-parameter type classes with
 fundeps:


 http://hackage.haskell.org/package/abstract-par-0.3.1/docs/Control-Monad-Par-Class.html#g:1

 And I'm trying to port it to use type families.  But the following
 combination seems to be completely unusable for me right now:

 class ParFuture m  = ParIVar m  where

   new  :: forall a . m (Future m a)


 You can see the error when you try loading this file at this line:


 https://github.com/iu-parfunc/lvars/blob/b60cafb941ea8f2f333ada9b5206cd21211eae26/haskell/par-classes/Control/Par/Class.hs#L159

 Future is a type-function from the superclass.  I can't seem to use
 new in any way at any type without getting:

 Control/Par/Class.hs:161:9:
 Could not deduce (Future m a ~ Future m a0)
 from the context (ParIVar m, FutContents m a)
   bound by the type signature for
  newFull_ :: (ParIVar m, FutContents m a) = a - m (IVar
 m a)
   at Control/Par/Class.hs:151:13-74
 NB: `Future' is a type function, and may not be injective
 The type variable `a0' is ambiguous
 Possible fix: add a type signature that fixes these type variable(s)
 Expected type: m (IVar m a)
   Actual type: m (Future m a0)
 In the expression: (new :: m (IVar m a))
 In a pattern binding: _ = (new :: m (IVar m a))
 In an equation for `newFull_':
 newFull_ a
   = do { return undefined }
   where
   _ = (new :: m (IVar m a))
 Failed, modules loaded: none.

 Ok, so it seems like the type of new may just be intrinsically unusable.
  There is no way, by constraining the output of the new function for the
 type system to infer what input to the Future type function was.  (Type
 function not reversable / injective.)

 So am I just stuck?  I don't want a dummy, unused argument just to
 communicate the type information to new.  Is this just a place where *MPTC
 + fundeps works but type familes do not?  *Or is there some way that
 roles can save the day here?  Do I need to *say that the 'a' parameter
 has a representation role*?

 Thanks,
   -Ryan


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


Re: [Haskell-cafe] [ANNOUNCE] Penny - double-entry accounting

2013-10-06 Thread Simon Michael

On 10/2/13 4:55 PM, Omari Norman wrote:

I'm pleased to make the first public announcement of the availability of
Penny, a double-entry command-line accounting system.


Hurrah! Congrats Omari.

Will there be a 1.0 release, or will you be forever chasing that number 
like me ?



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


Re: [Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?

2013-10-06 Thread Carter Schonwald
(replicating what i said on the ghc-devs thread)

one thing i'm confused by, and this wasn't properly addressed in the prior
threads,
is

for a type like

data Annotated t ann =  MkAnn t ann

would you consider the following unsafe?

instance Eq t = Eq ( Annotated t ann)
   (==) (MkAnn t1 _) (MkAnn t2 _ ) =  t1 == t2

instance Ord t = Ord (Annotated t ann)
  compare (MkAnn t1 _) (MkAnn t2 _) = compare t1 t2

by the rubric you've proposed these might be *BAD*, right? But theres many
cases where you're doing computation on data, and you wish to track origin,
time, etc, but these annotations are *irrelevant* for the actual values
computed... It sounds like the proposal you want would rule out such
instances!

your proposal would rule out these pretty natural Ord/Eq instances!

am i not understanding your proposal?

It seems like  you want LVish to be deterministic in the sense of up to
equality/ordering equivalence, the computation will always yield the same
answer .

Haskell has no way of enforcing totality, and deriving a SafeEq via
generics is wrong, see the Annotated type example i made up, above.

If you define determinism up to the equivalence/ordering relations
provided, and assuming anyone using LVish can read the docs before using
it, is there really any real problem? are there any *real* example
computations that someone might naively do despite the warning where the
actual answer would be broken because of this?

If we had a richer type system (like say, Idris plus some totality info),
how would we enforce the safety conditions needed to make LVish truely
deterministically type safe?

cheers
-Carter


On Sun, Oct 6, 2013 at 6:54 PM, Tillmann Rendel 
ren...@informatik.uni-marburg.de wrote:

 Hi,


 Ryan Newton wrote:

 It is very hard for me to
 see why people should be able to make their own Generic instances (that
 might lie about the structure of the type), in Safe-Haskell.


 I guess that lying Generics instances might arise because of software
 evolution. Let's say we start with an abstract data type of binary trees.

   module Tree (Tree, node, empty, null, split) where
 data Tree a = Node (Tree a) (Tree a) | Empty
   deriving Generics

 node = Node

 empty = Empty

 null Empty = True
 null _ = False

 split (Node a b) = (a, b)

 size Empty = 0
 size (Node x y) = size x + size y

 Note that this data type is not really abstract, because we export the
 Generics instance, so clients of this module can learn about the
 implementation of Tree. This is not a big deal, because the chosen
 implementation happens to correspond to the abstract structure of binary
 trees anyway. So I would expect that generic code will work fine. For
 example, you could use generic read and show functions to serialize trees,
 and get a reasonable data format.

 Now, we want to evolve our module by caching the size of trees. We do
 something like this:

   module Tree (Tree, node, empty, null, split) where
 data Tree a = Tree !Int (RealTree a)

 data RealTree a = Node (Tree a) (Tree a) | Empty

 tree (Node a b) = Tree (size a + size b) t
 tree Empty = Tree 0 Empty

 node x y = tree (Node x y)

 empty = tree Empty

 null (Tree _ Empty) = True
 null _ = False

 split (Tree _ (Node a b)) = (a, b)

 size (Tree n _) = n

 Except for the Generics instance, we provide the exact same interface and
 behavior to our clients, we just traded some space for performance. But
 what Generics instance should we provide? If we just add deriving
 Generics to the two datatypes, we leak the change of representation to our
 clients. For example, a client that serialized a tree with a generic show
 function based on the old Tree cannot hope to deserialize it back with a
 generic read function based on the new Tree. The size information would be
 missing, and the structure would be different.

 If we write a Generics instance by hand, however, I guess we can make it
 present the exact same structure as the derived Generics instance for the
 old Tree. With this lying instance, the generic read function will happily
 deserialize the old data. The size will be computed on the fly, because our
 hand-written Generics instance will introduce calls to our smart
 constructors.


   Tillmann
 __**_
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://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] Any precedent or plan for guaranteed-safe Eq and Ord instances?

2013-10-06 Thread adam vogt
On Sun, Oct 6, 2013 at 6:54 PM, Tillmann Rendel
ren...@informatik.uni-marburg.de wrote:
 Hi,


 Ryan Newton wrote:

 It is very hard for me to
 see why people should be able to make their own Generic instances (that
 might lie about the structure of the type), in Safe-Haskell.


 I guess that lying Generics instances might arise because of software
 evolution. Let's say we start with an abstract data type of binary trees.

Hi,

A real example exists in containers for the older Data class.
Data.Sequence.Seq pretends it is a list instead of a tree:

 gshow (S.fromList [1,2,3] S.| 4)
(| (1) (| (2) (| (3) (| (4) (empty)

If there was a Generic instance for Seq, it would probably pretend to
be a list for the same reasons the Data instance is that way.

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


Re: [Haskell-cafe] Music update

2013-10-06 Thread Evan Laforge
I saw the the video on g+, it's especially nice with live
instruments.  I noticed the code had a fair amount of stuff dealing
with limitations of the auto-bass, I assume you had to be careful not
to gum up its works.  Is there a robotic drumset back there somewhere
too?

Also change ringing is new to me, I wasn't aware of that particular
tradition.  I assume real ringers have a pretty limited set of pitches
to work with, but it sounds like you're changing the pitch sets over
time, is there a larger structure at work?

On Fri, Sep 27, 2013 at 12:27 PM, Mark Lentczner
mark.lentcz...@gmail.com wrote:
 Yes, video was shot and several audio recordings taken. I'm mastering the
 audio and expect to have something in a week to share.


 On Mon, Sep 23, 2013 at 4:21 AM, Dan Krol orbliv...@gmail.com wrote:

 Will there be a video of the live premier?


 On Fri, Sep 20, 2013 at 12:14 PM, Mark Lentczner
 mark.lentcz...@gmail.com wrote:

 Some might remember me asking about music packages a while back... An
 update:

 I ended up using Euterpea, which in turn uses both Codec.Midi and
 Sound.PortMidi. My working environment was to have my code loaded up in
 ghci, play MIDI into a software MIDI bus, and pipe that into MainStage 3
 which ran the synths.

 The piece I was working on premiered last night at a concert in
 Wellington, NZ. The live recording will take a while, but you can hear a
 studio synth recording (from the above setup) here:

 https://soundcloud.com/mtnviewmark/plain-changes-2-all-synth-mix


 The code for the piece is all open source:
 https://github.com/mzero/PlainChanges2. In particular, there is a somewhat
 improved MIDI player in there.

 Enjoy!

 - Mark

 P.S.: Yes, and now that that's done with, I can get on with the next
 Haskell Platform release!


 ___
 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

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


Re: [Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?

2013-10-06 Thread Ryan Newton
Tillmann,

Thanks, that is in interesting use case for handwritten Generics.

I'm not fully dissuaded though, simply because:

(1) it can't be too common!  Especially when you intersect the people who
have done or will do this with the people who care about SafeHaskell.
 (Again, if they don't, they won't mind this tiny Unsafe toggle.)

(2) even people who fall in this intersection still have the recourse of
doing what they need to do and asserting TrustWorthy.  SafeHaskell is
good at supporting this kind of individual exception.

Whereas in my case I have no recourse!  Because my problem not about
asserting that a particular module is TrustWorthy, but rather about keeping
other users (running in -XSafe) from breaking my library.



On Sun, Oct 6, 2013 at 6:54 PM, Tillmann Rendel 
ren...@informatik.uni-marburg.de wrote:

 Hi,


 Ryan Newton wrote:

 It is very hard for me to
 see why people should be able to make their own Generic instances (that
 might lie about the structure of the type), in Safe-Haskell.


 I guess that lying Generics instances might arise because of software
 evolution. Let's say we start with an abstract data type of binary trees.

   module Tree (Tree, node, empty, null, split) where
 data Tree a = Node (Tree a) (Tree a) | Empty
   deriving Generics

 node = Node

 empty = Empty

 null Empty = True
 null _ = False

 split (Node a b) = (a, b)

 size Empty = 0
 size (Node x y) = size x + size y

 Note that this data type is not really abstract, because we export the
 Generics instance, so clients of this module can learn about the
 implementation of Tree. This is not a big deal, because the chosen
 implementation happens to correspond to the abstract structure of binary
 trees anyway. So I would expect that generic code will work fine. For
 example, you could use generic read and show functions to serialize trees,
 and get a reasonable data format.

 Now, we want to evolve our module by caching the size of trees. We do
 something like this:

   module Tree (Tree, node, empty, null, split) where
 data Tree a = Tree !Int (RealTree a)

 data RealTree a = Node (Tree a) (Tree a) | Empty

 tree (Node a b) = Tree (size a + size b) t
 tree Empty = Tree 0 Empty

 node x y = tree (Node x y)

 empty = tree Empty

 null (Tree _ Empty) = True
 null _ = False

 split (Tree _ (Node a b)) = (a, b)

 size (Tree n _) = n

 Except for the Generics instance, we provide the exact same interface and
 behavior to our clients, we just traded some space for performance. But
 what Generics instance should we provide? If we just add deriving
 Generics to the two datatypes, we leak the change of representation to our
 clients. For example, a client that serialized a tree with a generic show
 function based on the old Tree cannot hope to deserialize it back with a
 generic read function based on the new Tree. The size information would be
 missing, and the structure would be different.

 If we write a Generics instance by hand, however, I guess we can make it
 present the exact same structure as the derived Generics instance for the
 old Tree. With this lying instance, the generic read function will happily
 deserialize the old data. The size will be computed on the fly, because our
 hand-written Generics instance will introduce calls to our smart
 constructors.


   Tillmann
 __**_
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe

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


  1   2   3   4   5   6   7   8   9   10   >