Re: [haskell art] New release Csound-expression 4.9 is out

2015-10-30 Thread Anton Kholomiov
As usual the library is available on Hackage:

http://hackage.haskell.org/package/csound-expression

The github repo is at

https://github.com/spell-music/csound-expression

Other useful libraries that go with csound-expression are

csound-sampler, and csound-catalog:

   -

   csound-sampler <http://hackage.haskell.org/package/csound-sampler>
   -

   csound-catalog <http://hackage.haskell.org/package/csound-catalog>

​

2015-10-30 17:41 GMT+03:00 Anton Kholomiov <anton.kholom...@gmail.com>:

> *The 4.9.0 is out! New features:*
>
> csound-expression
>
>-
>
>Functions for creation of FM-synthesizers. We can create
>the whole graph of FM-units (with feedback). Check out the module
>Csound.Air.Fm
>-
>
>Support for Monosynth patches. See atMono in the module
>Csound.Air.Patch
>see the function atMono and atMonoSharp.
>-
>
>Easy to use Binaural panning. See the module Csound.Air.Pan
>It’s like:
>
> headPan :: (Sig, Sig) -> Sig -> Sig2headPan (azimuth, elevation) asig = 
> (aleft, aright)
>
> the compiler can supply the right extra files by reading the header of .csd
>
>-
>
>Construction of patches for sound fonts (sfPatch, sfPatchHall).
>-
>
>Table of tables. We can create a table that contains tables.
>-
>
>Harmonic oscillators for subtractive synth: buz and gbuz
>(the functions are adapted from the Csound ones)
>-
>
>Reverbs for patches. It’s very easy to add a reverb to your patch
>(withSmallHall patch, withLargeHall patch, etc)
>-
>
>Some bug-fixes
>
> csound-catalog
>
>- Many mono-synth were added. You can use them with function atMono
>in place of atMidi. The mono versions of patches have suffix m.
>Like hammonOrganm or nightPadm. We can use it like this:
>
> > dac $ atMono nightPadm
>
>
>- SHARC instruments. SHARC db contains a FFT-samples for sustain notes.
>It includes many orchestra instruments. There are many new patches that
>use natural sounding timbres taken from the SHARC library.
>Check out functions soloSharc, padSharc, dreamSharc.
>
> We can use it like this:
>
> > dac $ atMidi $ padSharc shCello
>
> csound-sampler
>
>-
>
>Handy function withBpm allows to query current bpm with in the scope
>of expression.
>-
>
>    Sampler mappers were generalized.
>-
>
>Char trigering functions are synchronized with bpm.
>
> Cheers!
> Anton
> ​
>

-- 

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

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


[haskell art] New release Csound-expression 4.9 is out

2015-10-30 Thread Anton Kholomiov
*The 4.9.0 is out! New features:*

csound-expression

   -

   Functions for creation of FM-synthesizers. We can create
   the whole graph of FM-units (with feedback). Check out the module
   Csound.Air.Fm
   -

   Support for Monosynth patches. See atMono in the module Csound.Air.Patch
   see the function atMono and atMonoSharp.
   -

   Easy to use Binaural panning. See the module Csound.Air.Pan
   It’s like:

headPan :: (Sig, Sig) -> Sig -> Sig2headPan (azimuth, elevation) asig
= (aleft, aright)

the compiler can supply the right extra files by reading the header of .csd

   -

   Construction of patches for sound fonts (sfPatch, sfPatchHall).
   -

   Table of tables. We can create a table that contains tables.
   -

   Harmonic oscillators for subtractive synth: buz and gbuz
   (the functions are adapted from the Csound ones)
   -

   Reverbs for patches. It’s very easy to add a reverb to your patch
   (withSmallHall patch, withLargeHall patch, etc)
   -

   Some bug-fixes

csound-catalog

   - Many mono-synth were added. You can use them with function atMono
   in place of atMidi. The mono versions of patches have suffix m.
   Like hammonOrganm or nightPadm. We can use it like this:

> dac $ atMono nightPadm


   - SHARC instruments. SHARC db contains a FFT-samples for sustain notes.
   It includes many orchestra instruments. There are many new patches that
   use natural sounding timbres taken from the SHARC library.
   Check out functions soloSharc, padSharc, dreamSharc.

We can use it like this:

> dac $ atMidi $ padSharc shCello

csound-sampler

   -

   Handy function withBpm allows to query current bpm with in the scope
   of expression.
   -

   Sampler mappers were generalized.
   -

   Char trigering functions are synchronized with bpm.

Cheers!
Anton
​

-- 

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

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


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

2015-09-16 Thread Anton Kholomiov
Alas there is no CsdSco typeclass anymore.
The original idea was to implement score type with
the most basic type and give the user a chance to write converters
and use score playing functionality by the class CsdSco.
But I've noticed that this approach was preventing me from using
advanced score structures (they are implemented in the separate package).
And type signatures become scary for the novice.
So I've settled down the type. It's like choosing between Prelude.List
ListLike.List. I've decided to pick the simplest one.

You can write your own converter to the `Sco` type.


type Sco a = Track
<http://hackage.haskell.org/package/temporal-media-0.6.0/docs/Temporal-Media.html#t:Track>
 D
<http://hackage.haskell.org/package/csound-expression-4.8.2/docs/Csound-Types.html#t:D>
 a
```

The `Track` comes from temporal-media package.
It's very easy to construct it from list of events.
One possible solution:

```
type Note = (Double, Double, a)

fromEvents :: [Note] -> Sco a
fromEvents = har . fmap f
 where f (start, duration, a) = del (double start) $ str (double
duration) $ temp a
```

Notice the need for converting to csound doubles (`D`s). The `har` is
parallel composition.
`del` is for delaying nd `str` is for stretching in time domain. `temp`
creates an event
that lasts for one seconds and starts right away.
I don't know your type, but I think it can be rendered to a list of notes.

Then you can plug the converter to the functions: `sco` or `atSco` (used
for patches).


Cheers,
Anton

2015-09-15 22:11 GMT+03:00 Edward Lilley <ejlil...@gmail.com>:

> Hi
>
> The most useful part of this (for me) is the ability to play midi-style
> instruments at arbitrary frequencies, so this looks great!
>
> To that end, I'm looking for the definition of the 'CsdSco' typeclass,
> as I want to write my own instance. It seems to be referenced in the
> csound-expression documentation, and once in a code comment, but is
> otherwise absent from the source. Indeed, installing temporal-csound
> from hackage fails with the error
>
> src/Csound.hs:135:10:
> Not in scope: type constructor or class ‘CsdSco’
>
> Where do I find it?
>
> thanks,
> Edward
>
> Anton Kholomiov <anton.kholom...@gmail.com> writes:
>
> > 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!
>
>

-- 

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

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


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

2015-09-15 Thread Edward Lilley
Hi

The most useful part of this (for me) is the ability to play midi-style
instruments at arbitrary frequencies, so this looks great!

To that end, I'm looking for the definition of the 'CsdSco' typeclass,
as I want to write my own instance. It seems to be referenced in the
csound-expression documentation, and once in a code comment, but is
otherwise absent from the source. Indeed, installing temporal-csound
from hackage fails with the error

src/Csound.hs:135:10:
Not in scope: type constructor or class ‘CsdSco’

Where do I find it?

thanks,
Edward

Anton Kholomiov <anton.kholom...@gmail.com> writes:

> 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!


-- 

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

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 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


[haskell art] the library of beautiful instruments implemented in haskell / csound

2015-09-13 Thread Anton Kholomiov
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!

-- 

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

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 art] 3rd CFP FARM 2015 -- final reminder

2015-05-11 Thread Anton Kholomiov


 3rd CFP FARM 2015

3rd ACM SIGPLAN International Workshop on
Functional Art, Music, Modelling and Design

 Vancouver, Canada, 5 September, 2015
 affiliated with ICFP 2015


Full Paper and Demo Abstract submission Deadline: 17 May



The ACM SIGPLAN International Workshop on Functional Art,
Music, Modelling and Design (FARM) gathers together people
who are harnessing functional techniques in the pursuit of
creativity and expression.

Functional Programming has emerged as a mainstream software
development paradigm, and its artistic and creative use is
booming. A growing number of software toolkits, frameworks
and environments for art, music and design now employ
functional programming languages and techniques. FARM is a
forum for exploration and critical evaluation of these
developments, for example to consider potential benefits of
greater consistency, tersity, and closer mapping to a
problem domain.

FARM encourages submissions from across art, craft and
design, including textiles, visual art, music, 3D sculpture,
animation, GUIs, video games, 3D printing and architectural
models, choreography, poetry, and even VLSI layouts, GPU
configurations, or mechanical engineering designs. The
language used need not be purely functional (“mostly
functional” is fine), and may be manifested as a domain
specific language or tool. Theoretical foundations, language
design, implementation issues, and applications in industry
or the arts are all within the scope of the workshop.

Submissions are invited in two categories:

  * Full papers

5 to 12 pages using the ACM SIGPLAN template. FARM 2015
is an interdisciplinary conference, so a wide range of
approaches are encouraged and we recognize that the
appropriate length of a paper may vary considerably
depending on the approach. However, all submissions must
propose an original contribution to the FARM theme, cite
relevant previous work, and apply appropriate research
methods.


  * Demo abstracts

Demo abstracts should describe the demonstration and its
context, connecting it with the themes of FARM. A demo
could be in the form of a short (10-20 minute) tutorial,
presentation of work-in-progress, an exhibition of some
work, or even a performance. Abstracts should be no
longer than 2 pages, using the ACM SIGPLAN template and
will be subject to a light-touch peer review.

If you have any questions about what type of contributions
that might be suitable, or anything else regarding
submission or the workshop itself, please contact the
organisers at:

farm-2...@easychair.org


KEY DATES:

Full Paper and Demo Abstract submission Deadline:   17 May
Author Notification:26 June
Camera Ready:   19 July
Workshop:   5 September



SUBMISSION

All papers and demo abstracts must be in portable document
format (PDF), using the ACM SIGPLAN style guidelines. The
text should be in a 9-point font in two columns. The
submission itself will be via EasyChair:

https://easychair.org/conferences/?conf=farm2015

PUBLICATION

Accepted papers will be included in the formal proceedings
published by ACM Press and will also be made available
through the the ACM Digital Library; see
http://authors.acm.org/main.cfm for information on the
options available to authors. Authors are encouraged to
submit auxiliary material for publication along with their
paper (source code, data, videos, images, etc.); authors
retain all rights to the auxiliary material.



WORKSHOP ORGANISATION

Workshop Chair: Henrik Nilsson, University of Nottingham

Program Chair: David Janin, University of Bordeaux

Publicity Chair: Samuel Aaron, University of Cambridge

Program Committee:

Samuel Aaron, University of Cambridge
Jean Bresson, IRCAM Paris
David Broman, KTH and UC Berkeley
David Janin (chair), University of Bordeaux
Anton Kholomiov, Orffeus instrumental ensemble Moscow
Alex Mclean, University of Leeds
Carin Meier, Outpace Systems
Henrik Nilsson, University of Nottingham
Yann Orlarey, GRAME Lyon
Donya Quick, Yale University
Shigeki Sagayama, Meiji University
Chung-chieh Shan, Indiana University
Michael Sperber, Active Group GmbH
Bodil Stokke, FutureAdLabs

For further details, see the FARM website:
http://functional-art.org

-- 

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

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


Re: [haskell art] Music made with Haskell

2014-12-01 Thread Anton Kholomiov
Thanks for the kind words. It was a long road to making the tracks

2014-12-01 4:34 GMT+03:00 Francesco Ariis fa...@ariis.it:

 ― Attachment links are at the end of this email ―

 On Fri, Nov 28, 2014 at 12:47:48PM +0400, Anton Kholomiov wrote:
  I wrote two tracks completely with Haskell.
  You can listen to them on the soundcloud:

 I finally listened to them, enjoyed the pieces very much, especially
 the soothing Ocean. The code of the songs is slender and understandable
 too, which says a lot about the expressiveness of the library.
 Hope to hear more from you!
 Haskell Art now contains the following file

 http://lurk.org/r/file/nFZV4c8qtpakhypQ8qLsZLbNvOh-du-2uIm3Mv
 Name:
 Type: application/pgp-signature
 Size: 0KB


 --

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

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


-- 

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

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


[haskell art] [Announce] Music Suite v1.8

2014-11-30 Thread Hans Höglund
I am happy to announce the release of Music Suite version 1.8.

This release in short: Cleaner API for dealing with Voices, Notes and time 
structures in general. New equal-temperament pitch representation. Improved 
handling of diatonic vs. chromatic transposition in the Common pitch 
representation. Better support for clef and staff line positions. Better 
support for handling instrument ambitus etc.

See full notes at 
https://github.com/music-suite/music-docs/blob/master/releases/Notes.md#18

The Music Suite is a language for description, analysis, composition and 
manipulation of music embedded in Haskell. For more information see 
http://music-suite.github.io or my talk at FARM2014 
http://functional-art.org/2014/.

Regards,
Hans Hoeglund

-

https://twitter.com/hanshogl
https://soundcloud.com/hanshoglund
http://github.com/hanshoglund
-- 

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

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


Re: [haskell art] Music made with Haskell

2014-11-30 Thread Francesco Ariis
― Attachment links are at the end of this email ―

On Fri, Nov 28, 2014 at 12:47:48PM +0400, Anton Kholomiov wrote:
 I wrote two tracks completely with Haskell.
 You can listen to them on the soundcloud:

I finally listened to them, enjoyed the pieces very much, especially
the soothing Ocean. The code of the songs is slender and understandable
too, which says a lot about the expressiveness of the library.
Hope to hear more from you!
Haskell Art now contains the following file

http://lurk.org/r/file/nFZV4c8qtpakhypQ8qLsZLbNvOh-du-2uIm3Mv
Name: 
Type: application/pgp-signature
Size: 0KB


-- 

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

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


Re: [haskell art] Music made with Haskell

2014-11-29 Thread Francesco Ariis
On Fri, Nov 28, 2014 at 12:47:48PM +0400, Anton Kholomiov wrote:
 I wrote two tracks completely with Haskell.
 You can listen to them on the soundcloud:

I downloaded the zip'd source, but I cannot listen to your track
on soundcloud (it requires Flash, and Linux doesn't play well
with Flash).
Is there any other place I can download them from?

-- 

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

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


Re: [haskell art] Music made with Haskell

2014-11-29 Thread Anton Kholomiov
You can listen in the ghci!

ghci
:l Celtic.hs
 main

It relies on csound-sampler.  Which can be installed from Hackage with
cabal:

cabal install csound-sampler

And the csound should be installed. See csounds.com


2014-11-29 17:09 GMT+04:00 Francesco Ariis fa...@ariis.it:

 On Fri, Nov 28, 2014 at 12:47:48PM +0400, Anton Kholomiov wrote:
  I wrote two tracks completely with Haskell.
  You can listen to them on the soundcloud:

 I downloaded the zip'd source, but I cannot listen to your track
 on soundcloud (it requires Flash, and Linux doesn't play well
 with Flash).
 Is there any other place I can download them from?

 --

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

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


-- 

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

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


[haskell art] Music made with Haskell

2014-11-28 Thread Anton Kholomiov
I wrote two tracks completely with Haskell.
You can listen to them on the soundcloud:

https://soundcloud.com/anton-kho/celtic

https://soundcloud.com/anton-kho/invisible-ocean

The music is based on samples but
a single track uses no more than 6 samples.
The code is under 100 lines of code.
I'm using my libs csound-sampler and csound-expression.

You can check out the source code at:

http://ge.tt/3MjwF852/v/0

Please turn off the AdBlock for this page to download the code.

Happy haskelling!
Anton

-- 

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

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


[haskell art] haskell in several upcoming live performances in the UK

2014-07-02 Thread Renick Bell
Hello everyone. I hope the Haskell Cafe will tolerate this musical interruption.

I suppose it's not so often that you can hear two different performers
use Haskell in their performances in one concert, but if you live in
the UK you have several opportunities to do so in the next few days.

Both Alex McLean and I will be playing at Algorave NIME on Thursday
night in London at Corsica Studios. The event starts at 21:00. Alex
will be playing in the duo Canute with Matthew Yee-King, and I will be
playing a solo set.

http://www.nime2014.org/public-events/concerts-and-installations/

After that, it's the UK algorave tour, with stops in Brighton (07/04),
Sheffield (07/06), Leeds (07/07), Manchester (07/08), and York
(07/09):

http://algorave.com/

Both Alex and I will perform in Sheffield and Manchester. I will be
playing all of the above dates.

See Alex fling Haskell in Emacs and me in vim, tmux, and xmonad!

If you haven't heard Alex's music recently, he did a great track the other day:

https://soundcloud.com/yaxu/at-last

There's this set he did in Antwerp in May:

https://www.youtube.com/watch?v=fgRDKxkHCSw

My sets are likely to resemble this one that I did last Friday in Portugal:

https://soundcloud.com/renick/live-at-xcoax-2014-porto-portugal-june-27-2014

Or this one from the Linux Audio Conference in May:

https://soundcloud.com/renick/live-at-the-linux-audio-conference-2014-karlsruhe-germany-may-5th-2014

If you come to one of the performances, please come up and say hello.
I really want to meet the UK Haskell crew!

Hope to see you there, dancing to Haskell or just relaxing and
enjoying the music.

Best,

Renick

-- 
Renick Bell
- http://renickbell.net
- http://twitter.com/renick
- http://the3rd2nd.com

-- 

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

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


  1   2   3   4   5   6   7   8   9   10   >