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


[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


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


Re: [Haskell-cafe] Music / MIDI help

2013-07-10 Thread Anton Kholomiov
For midi you can try my packages: temporal-music-notation and
temporal-music-notation-demo (and maybe temporal-music-notation-western).
It looks like Haskore but different inside. It tries to be clear, minimal,
more efficient and documented (as far as my english goes though).

Anton


2013/7/10 Mark Lentczner mark.lentcz...@gmail.com

 I'm a little lost in the bewildering array of music packages for Haskell,
 and need some help.

 I'm looking to recreate one of my algorithmic music compositions from the
 1980s. I can easily code the logic in Haskell.

 I'm looking for a the right set of packages and SW so that I can:
 a) generate short sequences and play them immediately, preferrably in ghci,
 -- but 'runHaskell Foo.hs | barPlayer' would be acceptable
 2) generate MIDI files

 I'm on OS X.

 So far what I've found is: Haskore, the midi package, and the jack package
 - and then I'd need some MIDI software synth for the Mac, and Jack based
 patcher Or perhaps I want SuperCollider, and the Haskell bindings - but
 that seems rather low level for my needs here (I don't really need to patch
 together my instruments, and I don't want to have re-write the whole timing
 framework from scratch.)

 So - What's a quick easy path here?

 - Mark


 ___
 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] Type classes

2013-05-28 Thread Anton Kholomiov
I don't understand the final part of the question but here are some
comments for the first part.

I don't like the phrase:

 the more powerfull a class is, the more fleixblility you have for
 combining them to complex programs

powerfull, more flexibility, complex programs -- are not so precise terms.

A = B

means that B can do everything that A can do and more (methods that are
specific to B). So if type is in B we can use all A's methods with it. Does
it make B more powerful or more flexible? Is Applicative less powerful than
a Monad? It depends on the program. If we don't ever need the B's specific
operations they will confuse us all the time. We are going to end up with
more complex program but not a better one. there are cases when Applicative
code is much better than a monadic one.

Anton



2013/5/28 Johannes Gerer kue...@gmail.com

 Dear Haskellers,

 While trying to understand the interconnection and hierarchy behind
 the important typeclasses, I stumbled upon the following question that
 I am not able to answer:

 There seems to be a hierachy of the type classes, in the sense, that
 the more powerfull a class is, the more fleixblility you have for
 combining them to complex programs. (Functor - Applicative -
 Arrow[Choice,Plus,Apply,..] - Monad). It was nice to read in the
 Typeclassopedia, that ArrowApply and Monad are equivalent, which is
 shown by deriving two instances from each other:

 instance Monad m = ArrowApply (Kleisli m)
 instance ArrowApply a = Monad (a anyType)

 The logic seems to be, that if I can derive from every instance of
 class A an instance of class B, then A is more powerfull than B and
 (in general) it is easier to be of class B than of class A (e.g. more
 types can be made Applicatives, than Monads)

 So far, I think I can follow. But what really hit me was the Cokleisli
 type. Using it and the logic from above, I can show that ANY type
 class is more (or equally) powerfull than the Monad:

 instance AnyClass m = Monad (Cokleilsi m anyType)

 I know this makes no sense, but where is the fallacy? Why even bother
 with the above derivation, if any type class can be made into a monad?

 I can see, that the Monad instance from above does not really
 transform the type a, but instead simply fix its first argument. But
 then on the other hand, the ArrowApply Instance does transform the m
 type (in a way similar to Cokleisli). If attention needs to be paid to
 the details, then what are they and why did they not matter above?

 Thanks,

 Johannes

 ___
 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] ANNOUNCE: new bridge! (prelude-prime)

2013-05-23 Thread Anton Kholomiov
I wish it was possible to use an extension

CustomPrelude = Prelude.Prime

In the cabal file




2013/5/23 Roman Cheplyaka r...@ro-che.info

 I liked Andreas's idea (cited below). Hence the new package
 prelude-prime.

 https://github.com/feuerbach/prelude-prime
 http://hackage.haskell.org/package/prelude-prime

 Pull requests are welcome, but let's stick to widely agreed changes
 (like the Foldable/Traversable one). I think one of the reasons why
 other Preludes haven't been adopted is because they were too radical.

 Let's see whether people here can put their code where their mouth is :)

 Roman

 * Andreas Abel andreas.a...@ifi.lmu.de [2013-05-20 13:26:05+0200]
  Maybe instead of fiddling with the current Prelude (which might break
  backwards compatibility), we should design a new prelude which is not
  automatically loaded but contains roughly the current prelude (with
  the list functions generalized to collections) plus the modern type
  class stack: Functor, Applicative, Monad, Foldable, Traversable,
  Monoid etc.
 
  I am willing to write
 
{-# LANGUAGE NoImplicitPrelude #-}
import Base
 
  if I get a decent, modern standard set of functions that could be
  considered as the base vocabulary of modern Haskell programmers...
 
  I just do not want to think about the democratic process involved in
  this design...
 
  Cheers,
  Andreas

 ___
 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] [ANN] hoodle-0.2

2013-03-30 Thread Anton Kholomiov
Things I have to install on Ubuntu to get it going: librsvg2-dev (for
svgcairo), libpoppler-glib-dev (for poppler), libgd2-xpm-dev (for gd).



2013/3/30 Ian-Woo Kim ianwoo...@gmail.com

 Hi, all,

 Pen note-taking program hoodle, which is being developed entirely in
 haskell, is updated to version 0.2.
 The previous version was 0.1.1.
 About what is hoodle, please refer to http://ianwookim.org/hoodle

 The changes in this version are
 - hoodle data format updated. now hoodle document has a unique id.
 - linking between documents implemented
 - vertical space inserting tool implemented
 - a widget introduced for panning and zooming
 - drag and drop linking implemented
 - drag and drop image embedding implemented
 - poppler pdf support is mandatory
 - pdf can be embedded in a file
 - toolbox ui reflects current hoodle state more correctly
 - slimmer select box design
 - several rendering glitches fixed

 Note that poppler is mandatory for hoodle (in the previous versions,
 poppler support was optional). One needs to install poppler-glib before
 installing hoodle.
 After gtk2hs and poppler installed, installing hoodle should be simply

  cabal install hoodle

 As for the detail information about wacom tablet support, please read
 installation page on the webpage.

 If you were using the previous versions of hoodle, you will find this
 version gives you much smoother experience and many interesting
 improvements. (especially adding vertical space tool and pan-zoom widget )

 Enjoy~

 best,
 Ian-Woo Kim


 ___
 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] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-23 Thread Anton Kholomiov
I don't know how to express it. You need to have some dynamic
representation since
dag is a container of `(Int, f Int)`. I've tried to go along this road

type Exp a = Fix (E a)

data E c :: * - * where
  Lit :: Show a = a - E a c
  Op  :: Op a - E a c
  App :: Phantom (a - b) c - Phantom a c - E b c

data Op :: * - * where
  Add :: Num a = Op (a - a - a)
  Mul :: Num a = Op (a - a - a)
  Neg :: Num a = Op (a - a)

newtype Phantom a b = Phantom { unPhantom :: b }

But got stuck with the definition of

app :: Exp (a - b) - Exp a - Exp b
app f a = Fix $ App (Phantom f) (Phantom a)

App requires the arguments to be of the same type (in the second type
argument `c`).

2013/2/23 Conal Elliott co...@conal.net


 On Tue, Feb 19, 2013 at 9:28 PM, Anton Kholomiov 
 anton.kholom...@gmail.com wrote:


 Do you think the approach can be extended for non-regular (nested)
 algebraic types (where the recursive data type is sometimes at a different
 type instance)? For instance, it's very handy to use GADTs to capture
 embedded language types in host language (Haskell) types, which leads to
 non-regularity.


 I'm not sure I understand the case you are talking about. Can you write a
 simple example
 of the types like this?


 Here's an example of a type-embedded DSEL, represented as a GADT:

  data E :: * - * where
Lit :: Show a = a - E a
Op  :: Op a - E a
App :: E (a - b) - E a - E b
...
 
  data Op :: * - * where
Add :: Num a = E (a - a - a)
Mul :: Num a = E (a - a - a)
Neg :: Num a = E (a - a)
...

 -- Conal

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


[Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-19 Thread Anton Kholomiov
I'm glad to announce the package for Common subexpression elimination [1].
It's an implementation of the hashconsig algorithm as described in the
paper
'Implementing Explicit and Finding Implicit Sharing in EDSLs' by Oleg
Kiselyov.

Main point of the library is to define this algorithm in the most generic
way.
You can define the AST for your DSL as fixpoint type[2]. And then all you
need
to use the library is to define the instance for type class `Traversable`.
This idea is inspired by `data-reify` [3] package which you can use to
transform
your ASTs to DAGs too. But it relies on inspection of the references for
values
when `data-fix-cse` doesn't sacrifices the purity.

A short example:

Let's define a tiny DSL for signals

import Data.Fix

type Name = String

type E = Fix Exp

data Exp a = Const Double | ReadPort Name | Tfm Name [a] | Mix a a
  deriving (Show, Eq, Ord)

We can make constant signals, read them from some ports and transform them
(apply some named function to the list of signals) and mix two signals.

Let's define an instance of the Traversable (hence for the Functor and
Foldable)

import Control.Applicative

import Data.Monoid
import Data.Traversable
import Data.Foldable

instance Functor Exp where
  fmap f x = case x of
 Const d - Const d
 ReadPort n - ReadPort n
 Mix a b - Mix (f a) (f b)
 Tfm n as - Tfm n $ fmap f as

instance Foldable Exp where
  foldMap f x = case x of
 Mix a b - f a  f b
 Tfm n as - mconcat $ fmap f as
 _ - mempty

instance Traversable Exp where
   traverse f x = case x of
  Mix a b - Mix $ f a * f b
  Tfm n as - Tfm n $ traverse f as
  a - pure a

Now we can use the functio `cse`

cse :: 
(Eqhttp://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Data-Eq.html#t:Eq(f
Inthttp://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Data-Int.html#t:Int),
Ordhttp://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Data-Ord.html#t:Ord(f
Inthttp://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Data-Int.html#t:Int),
Traversablehttp://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Data-Traversable.html#t:Traversablef)
=
Fixhttp://hackage.haskell.org/packages/archive/data-fix/0.0.1/doc/html/Data-Fix.html#t:Fixf
-
Daghttp://hackage.haskell.org/packages/archive/data-fix-cse/0.0.1/doc/html/Data-Fix-Cse.html#t:Dagf

to transform our AST to DAG. DAG is already sorted.

Later we can define a handy wrapper to hide the details from the client

newtype Sig = Sig { unSig :: E }

You can find examples in the package archive

Extra-Source-Files:
test/Exp.hs
test/Impl.hs
test/Expl.hs

If you want to see a real world example of usage you can find it
in the csound-expression[4]. An edsl for the Csound language.

One side-note form my experience: Fixpoint types can be very flexible.
It's easy to compose them. If suddenly we need to add some extra data
to all cases from the example above we can easily do it with just another
Functor:

Imagine that we want to use a SampleRate value with all signals.
Then we can do it like this:

type E = Fix SampledExp

data SampledExp a = SampledExp SampleRate (Exp a)

then we should define an instance of the type class Traversable
for our new type SampleRate. The Exp doesn't change.

[1] http://hackage.haskell.org/package/data-fix-cse-0.0.1
[2] http://hackage.haskell.org/package/data-fix-0.0.1
[3] http://hackage.haskell.org/package/data-reify
[4] http://hackage.haskell.org/package/csound-expression


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


Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-19 Thread Anton Kholomiov
There are several packages that already define fixpoints (another one is
about unification), but all packages that I'm aware of define a lot of
functionality
that I don't need (and actually don't understand, packages with fixpoint
types
tend to be rather dense with math). I'd like it to be simple and
lightweight.
Just fixpoints, just folds and unfolds.


2013/2/19 Emil Axelsson e...@chalmers.se

 2013-02-19 12:10, Anton Kholomiov skrev:

 I'm glad to announce the package for Commonsubexpression elimination [1].

 It's an implementation of the hashconsig algorithm as described in the
 paper
 'Implementing Explicit and Finding Implicit Sharing in EDSLs' by Oleg
 Kiselyov.

 Main point of the library is to define this algorithm in the most
 generic way.
 You can define the AST for your DSL as fixpoint type[2]. And then all
 you need
 to use the library is to define the instance for type class `Traversable`.


 One way to make the library even more useful would have been to base it on
 compdata instead of data-fix. Compdata has support for composable types and
 lots of extra functionality. On the other hand, it's easy enough to
 translate from compdata terms to your `Fix`...




  One side-note form my experience: Fixpoint types can be very flexible.
 It's easy to compose them. If suddenly we need to add some extra data
 to all cases from the example above we can easily do it with just another
 Functor:

 Imagine that we want to use a SampleRate value with all signals.
 Then we can do it like this:

 type E = Fix SampledExp

 data SampledExp a = SampledExp SampleRate (Exp a)

 then we should define an instance of the type class Traversable
 for our new type SampleRate. The Exp doesn't change.


 Very useful indeed! A more principled way to extend data types in this way
 is Data Types à la Carte:

   
 http://dx.doi.org/10.1017/**S0956796808006758http://dx.doi.org/10.1017/S0956796808006758

 (Implemented in compdata.)

 / Emil


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


Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-19 Thread Anton Kholomiov
 Do you think the approach can be extended for non-regular (nested)
 algebraic types (where the recursive data type is sometimes at a different
 type instance)? For instance, it's very handy to use GADTs to capture
 embedded language types in host language (Haskell) types, which leads to
 non-regularity.


I'm not sure I understand the case you are talking about. Can you write a
simple example
of the types like this?

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


Re: [Haskell-cafe] QuickCheck Generators

2012-11-22 Thread Anton Kholomiov
An idea. You can make a type:

data TestContains = TestContains Tweet TweetSet

and the make an Arbitrary instance for it. When you do
a recursove call you have three different tweets one new tweet
and two from the sub-calls. Then you can place one of them in the
result. In the end you will have a random TweetSet with some value from it.

Here is a scratch of the implementation:

instance Arbitrary TestContains where
   arbitrary = sized set'
   where set' 0 = mkSingleTweet $ (arbitrary :: Tweet)
 set' n = do
  t0 - arbitrary :: Tweet
  TestContains t1 ts1 - subTweets
  TestContains t2 ts2 - subTweets
  t - oneof [t0, t1, t2]
  return $ TestContains t $ TweetSet t0 ts1 ts2

 subTweets = set' (n `div` 2)


2012/11/21 gra...@fatlazycat.com

 I have

 data Tweet = Tweet {
 user :: String,
 text :: String,
 retweets :: Double
 } deriving (Show)

 data TweetSet = NoTweets | SomeTweets Tweet TweetSet TweetSet

 and trying to create some generators for testing, with

 instance Arbitrary Tweet where
   arbitrary = liftM3 Tweet arbitrary arbitrary arbitrary

 instance Arbitrary TweetSet where
   arbitrary = sized set'
 where set' 0 = return NoTweets
   set' n | n0 = oneof[return NoTweets, liftM3 SomeTweets
   arbitrary subTweets subTweets]
 where subTweets = set' (n `div` 2)

 but wondering how I would go about generating a random TweetSet that
 contains a known random Tweet I later have reference to and I would also
 assume the known Tweet to be placed randomly.

 Then I could test a contains function.

 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] ticketimer - haskell project on Gruender-Garage contest!

2012-09-28 Thread Anton Kholomiov
I'd like to announce ticketimer.com -- it's a website
that is not done yet. With ticketimer you can
choose films for your local cinema. People can buy
tickets in advance and promote the films they like.

Do we need to eat this blockbuster stuff all the time?
See how to vote for a change on
http://www.indiegogo.com/ticketimer?a=1301421

We are going to use Yesod as a main weapon.

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


Re: [Haskell-cafe] ANN: wizards-1.0: A High level, generic library for interrogative user interfaces

2012-07-01 Thread Anton Kholomiov
You have implemented very general idea as
a part of your library (Data type a la carte).
Maybe it's better to make a separate package?
Other developers would benefit from it. I saw some other
packages and they implement it too.


Anton


2012/7/1 Liam O'Connor lia...@cse.unsw.edu.au

 I know it's somewhat evil (:P), but I was unable to implement the
 subsumption constraints (::) in a way that avoided it. It's there because
 I'm (ab)using the type-class system to do computation (specifically an O(n)
 search though long chain of coproducts for a specific constructor). E.g,
 determining Foo :: Bar :+: Foo :+: Baz. There may be a way to rearrange
 the type level stuff to make it go away, perhaps with some new type
 extensions in 7.4 that I haven't studied extensively yet.

 This is also a problem in Swierstra's original paper where he introduces
 this technique. In practice, it doesn't pose a problem, because you're not
 meant to define your own instances of :: anyway, and you shouldn't care
 what order the constructors occur.

 Regards,
 Liam O'Connor


 On Sunday, 1 July 2012 at 6:37 PM, Krzysztof Skrzętnicki wrote:

  Hello,
 
  This library looks very nice. Thank you for realeasing it! I realise it
 took quite an effort to write it.
 
  Looking from examples on Github I noticed that you use
 -XOverlappingInstances. Why do you need such extension?
 
  Best regards,
  Krzysztof Skrzętnicki
 
  On Sun, Jul 1, 2012 at 10:17 AM, Liam O'Connor 
  lia...@cse.unsw.edu.au(mailto:
 lia...@cse.unsw.edu.au) wrote:
   Hi all,
  
   wizards is an Haskell library designed for the quick and painless
 development of interrogative programs, which revolve around a dialogue
 with the user, who is asked a series of questions in a sequence much like
 an installation wizard.
  
   Everything from interactive system scripts, to installation wizards,
 to full-blown shells can be implemented with the support of wizards.
  
   It is developed transparently on top of a free monad (see Swierstra's
 excellent paper on this topic at
 http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf (
 http://www.cs.ru.nl/%7EW.Swierstra/Publications/DataTypesALaCarte.pdf)http://www.cs.ru.nl/%7EW.Swierstra/Publications/DataTypesALaCarte.pdf%29),
 which separates out the semantics of the program from the wizards
 interface. A variety of backends exist, including a full featured backend
 for Haskeline, a debug-friendly simpler implementation in terms of
 System.IO primitives, and a completely pure implementation modelled as a
 function from an input string to output. It is also possible to write your
 own backends, or extend the existing back-ends with new features.
  
   While both built-in IO backends operate on a console, there is no
 reason why wizards cannot also be used for making GUI wizard interfaces.
  
   The library is highly extensible - back-ends can be written or
 extended with the type system helpfully tracking what features are
 supported by which back-ends.
  
   Installation instructions and some educational examples are at the
 github page:
  
   https://github.com/liamoc/wizards
  
   Information on how to write backends or extend backends, as well as
 structured API documentation is available on Hackage:
  
   http://hackage.haskell.org/package/wizards
  
   (Or, you can just run cabal haddock to generate the documentation from
 the source).
  
   Regards,
   Liam O'Connor
  
  
   ___
   Haskell-Cafe mailing list
   Haskell-Cafe@haskell.org (mailto:Haskell-Cafe@haskell.org)
   http://www.haskell.org/mailman/listinfo/haskell-cafe
 




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

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


Re: [Haskell-cafe] Martin Odersky on What's wrong with Monads

2012-06-25 Thread Anton Kholomiov
The class you're looking for is Applicative. The (*) operator handles
application of effectful things to effectful things, whereas ($)
handles the application of non-effectful things to effectful things.
This situation is interesting because it highlights the fact that there is
a distinction between the meaning of whitespace between function and
argument vs the meaning of whitespace between argument and argument.


`Applicative` is not enough for monads.
`Applicative` is like functor only for functions
with many arguments. It's good for patterns:

(a - b - c - d) - (m a - m b - m c - m d)

Monads are good for patterns

(a - b - c - m d) - (m a - m b - m c - m d)

So I can not express it with `Applicative`. My
analogy really breaks down on functions with
several arguments, since as you have pointed out there are
two white spaces. But I like the idea of using
one sign for normal and monadic  and maybe applicative
applications.

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


Re: [Haskell-cafe] Martin Odersky on What's wrong with Monads

2012-06-24 Thread Anton Kholomiov
do-notation is just syntax in theory but in practice
it's difficult to avoid it. Try to write any OpenGL
program in terms of `=`,  `` and `return`.
I don't like to use `do` knowing that it's just
syntax sugar but sometimes it help a lot.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Martin Odersky on What's wrong with Monads

2012-06-24 Thread Anton Kholomiov
Here is an half-baked idea how to make monads more functional.
It's too wild to be implemented in haskell.
But maybe you are interested more in ideas than implementations,
so let's start with monad class

class Monad m where
return :: a - m a
(=)  :: m a - (a - m b) - m b


I think monad's methods are misleading, let's rename them

class Monad m where
idM  :: a - m a
(*$) :: (a - m b) - m a - m b


We can see that `return` is a monadic identity and the `bind`
is an application in disguise. So now we have two applications.
It's standard `($)` and monadic `(*$)`. But they are application.
Well isn't it something like `plusInt` and `plusDouble`?
Maybe we can devise single class for application. Let's
imagine a special class `App`

class App ?? where
($) :: ???

As you can see it's defined so that we can fit
monads and plain functions in this framework. Moreover
if we redefine this class than whitespace is redefined
automatically! So `($)` really means *white space* in haskell.

`idM` is interesting too. In standard world we can safely
put `id` in any expression. So when we write

f = a + b

we can write

f = id (a + b)

or even

f = id ((id a) + (id b))

meaning doesn't change. So if we have special class `Id`

class Id f where
id :: ???

Again you can see that monads fit nicely in the type.
Why do we need this class? Whenever compiler gets an type mismatch,
it tries to apply method from `Id` class, if it's defined ofcourse.

But we have a class called `Category`, `id` belongs to it:

class Category (~) where
id   :: a ~ a
() :: (a ~ b) - (b ~ c) - (a ~ c)


Let's pretend that `()` is reversed composition `(.)`.
It's interesting to note that there is another formulation
of 'Monad' class. It's called Kelisli category.

class Kelisli m where
idK  :: a - m a
() :: (a - m b) - (b - m c) - (a - m c)

Here again let's forget about monad's `()` for a moment,
here it's composiotion. `Kleisli` is equivalent to `Monad`.

If we can define `Category` instance for `Kleisli`, so that
somehow this classes become unified on type level we
can define application in terms of composition like this:

f $ a = (const a  f) ()

And we can get application for monads (or kleislis :) ).

Implications:

Maybe someday you wrote a function like this:

foo :: Boo - Maybe Foo
foo x = case x of
1 - Just ...
2 - Just ...
3 - Just ...
4 - Just ...
5 - Just ...
6 - Just ...
7 - Just ...
_ - Nothing

with `idM` rule you can skip all Just's

You can use white space as monadic bind. So functional application
can become monadic on demand. Just switch the types.


Implementation:

I've tried to unify `Category` and `Kleisli` with no luck.
Here is a closest sletches:

simplest sketch requires type functions :(


instance Monad m = Category (\a b - a - m b) where
...


the other one too :(

class Category (~) where
type Dom (~) :: * - *
type Cod (~) :: * - *

id   :: Dom (~) a - Cod (~) a
() :: (Dom (~) a ~ Cod (~) b) - (Dom (~) b ~ Cod (~) c) - ...


instances

type Id a = a  -- :(

instance Monad m = Category (a - m b) where
type Dom (a - m b) = Id
type Cod (a - m b) = m

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


[Haskell-cafe] transformers problem: Could not deduce MonadTrans (StateT s) ??

2012-06-23 Thread Anton Kholomiov
Why this function doesn't compile?

phi :: Monad m = StateT s m ()
phi = lift $ return ()

I get (ghc-7.4.1)

Could not deduce (MonadTrans (StateT s))
  arising from a use of `lift'
from the context (Monad m)
  bound by the type signature for phi :: Monad m = StateT s m ()
  at FSMt.hs:28:1-22
Possible fix:
  add (MonadTrans (StateT s)) to the context of
the type signature for phi :: Monad m = StateT s m ()
  or add an instance declaration for (MonadTrans (StateT s))
In the expression: lift
In the expression: lift $ return ()
In an equation for `phi': phi = lift $ return ()
Failed, modules loaded: none.


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


Re: [Haskell-cafe] transformers problem: Could not deduce MonadTrans (StateT s) ??

2012-06-23 Thread Anton Kholomiov
No, it wants me to define an instance for
(StateT s) which is supposed to be defined
be the authors of the library.

Actually I discovered that I have two libraries
called transformers.

   transformers-0.2.2.0
   transformers-0.3.0.0

So when I'm doing

import Control.Monad.Trans (0.2.2.0)

I get the error

And when I'm doing

import Control.Monad.Trans.Class (0.3.0.0)

It compiles.


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


Re: [Haskell-cafe] transformers problem: Could not deduce MonadTrans (StateT s) ??

2012-06-23 Thread Anton Kholomiov
At last..

No, it wants me to define an instance for
(StateT s) which is supposed to be defined
be the authors of the library.

Actually I discovered that I have two libraries
called transformers.

   transformers-0.2.2.0
   transformers-0.3.0.0

So when I'm doing

import Control.Monad.Trans (0.2.2.0)

I get the error

And when I'm doing

import Control.Monad.Trans.Class (0.2.2.0)

It compiles.


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


Re: [Haskell-cafe] transformers problem: Could not deduce MonadTrans (StateT s) ??

2012-06-23 Thread Anton Kholomiov
Indeed, thank you. mtl is cruel with me for
the second time uumpf. But it's strange mtl
just reexports transformer's module



2012/6/23 MigMit miguelim...@yandex.ru


 On 23 Jun 2012, at 21:27, Anton Kholomiov wrote:

  At last..
 
  No, it wants me to define an instance for
  (StateT s) which is supposed to be defined
  be the authors of the library.
 
  Actually I discovered that I have two libraries
  called transformers.
 
 transformers-0.2.2.0
 transformers-0.3.0.0
 
  So when I'm doing
 
  import Control.Monad.Trans (0.2.2.0)

 Ehm... seems like you're importing mtl instead of transformers. AFAIK
 there is no Control.Monad.Trans module in transformers.

 
  I get the error
 
  And when I'm doing
 
  import Control.Monad.Trans.Class (0.2.2.0)
 
  It compiles.
 
 
  Anton
 
  ___
  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] transformers problem: Could not deduce MonadTrans (StateT s) ??

2012-06-23 Thread Anton Kholomiov
Maybe I export State from one library version
and instance from another?

2012/6/23 Anton Kholomiov anton.kholom...@gmail.com

 Indeed, thank you. mtl is cruel with me for
 the second time uumpf. But it's strange mtl
 just reexports transformer's module




 2012/6/23 MigMit miguelim...@yandex.ru


 On 23 Jun 2012, at 21:27, Anton Kholomiov wrote:

  At last..
 
  No, it wants me to define an instance for
  (StateT s) which is supposed to be defined
  be the authors of the library.
 
  Actually I discovered that I have two libraries
  called transformers.
 
 transformers-0.2.2.0
 transformers-0.3.0.0
 
  So when I'm doing
 
  import Control.Monad.Trans (0.2.2.0)

 Ehm... seems like you're importing mtl instead of transformers. AFAIK
 there is no Control.Monad.Trans module in transformers.

 
  I get the error
 
  And when I'm doing
 
  import Control.Monad.Trans.Class (0.2.2.0)
 
  It compiles.
 
 
  Anton
 
  ___
  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] lightweight alternative to mtl?

2012-06-16 Thread Anton Kholomiov
What are you using instead of mtl? I need simple type for State.
The more classy it gets the harder error messages are to understand.
I've installed new package. Silently it installed new mtl.
And here I'm staring into three lines of code for half an hour
trying to understand where I misused the types. Compiler
tells me long story about functional dependencies.
After downgrade it takes me a second to find the mistake.
Ohh type mismatch, forgot to pass an argument.

It's class for strict and lazy states. Maybe it's better
to take approach of containers (the same interface and different modules)?


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


Re: [Haskell-cafe] lightweight alternative to mtl?

2012-06-16 Thread Anton Kholomiov
I'd rather use 'transformers' then.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Need inputs for a Haskell awareness presentation

2012-05-31 Thread Anton Kholomiov
a) you can generate c++ with it :) (but don't tell it.
it may be regarded as offense)

b) -

c) -

d) stop debugging, you don't need it that much in
haskell. But you need profiler. If they really want
to print something in pure function you can show
them function 'trace', from Debug.Trace

e) I don't think that C++ people think that types are bad.
If they do you can tell (beside the types don't let you
mess up to much and stimulate clarity and documentation)
about how easy is to do refactoring in typed language.

f) You can show them Atom [1]. 5k Haskell code generates
20k C-code and it all works in real time in real trucks.
Or Copilot. It's going to be used in airplanes.

4. I think it's bad idea. It's better to start with
examples.

What really strikes me about haskell is the simplicity of
data types. I think the best way to start is to show
Booleans, then lists, then Trees. It's so simple and
beautiful

You can say. Do you really need to know anything
about syntax to understand this:

data Bool = False | True

or this

data Time = Time Hour Minute Second

or this

data List a = Nil | Cons a (List a)

and you can say that it is not built in. You can define it
yourself and it works as fast as any other data type
(or as slow).

You can stress the idea of haskell data types is
haskell UML.

Don't show definitions just show them types like this:

not :: Bool - Bool
and :: Bool - Bool - Bool

reverse :: [a] - [a]
map :: (a - b) - [a] - [b]

then you can show definitions and say about pattern matching.
It is very intuitive.


[1] http://hackage.haskell.org/package/atom
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Learn you

2012-05-06 Thread Anton Kholomiov
Well Russian translation title goes:
Learn Haskell in the name of the Kindness

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


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

2011-12-23 Thread Anton Kholomiov
I'd like to make special syntax for folds, so that fold is built in
the type definition. Maybe it can be some special
braces or just fold(..). So we can write the same function in
place of foldr, maybe, either and so on and don't have to define
them by hand.

Inside special fold-braces one can write functions (separated with | as
inside of type declaration) that have apropriate types. Constructors define
the order of functions inside fold-braces.

Handful of examples:

data List a = Nil | Cons a (List a)

length :: List a - List a
length = fold( 0 | const (+1) )

(++) :: List a - List a - List a
a ++ b = fold( b | Cons ) a

head :: List a - a
head = fold( undefined | const )

data Maybe a = Nothing | Just a

fromJust :: Maybe a - a
fromJust = fold (undefined | id)

data Nat = Zero | Succ Nat

add :: Nat - Nat - Nat
add a = fold (a | Succ)

mul :: Nat - Nat - Nat
mul a = fold (Zero | add a)


Maybe something similiar for unfolds but I have no syntax here.

--

I'd like to invent some type-system that can allow me to say that
 (.), (), (=)
are the same things just as
 id and pure

I'd like to have in place of Monad-class special case of Category class
We can express return and (=) with id and (.) in Monad's typing.

return = id
ma = mf = (mf . const ma) ()

where id and (.) are

class Kleisli m where
  id :: a - m a
  (.) :: (b - m c) - (a - m b) - (a - m c)

I'd like to parametrise it over m so Kleisli
can become a special case of Category.

And we ?can? define ($) in terms of id, (.), const and (),

($) :: Category cat = cat a b - ?dom cat a?- ?cod cat b?
f $ a = (f . const a) ()

so (=) becomes just ($)


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


Re: [Haskell-cafe] How to Create Programming Language with Haskell?

2011-11-16 Thread Anton Kholomiov
This can be very helpful: Implementation of FP languages by Simon Peyton
Jones

http://research.microsoft.com/en-us/um/people/simonpj/papers/slpj-book-1987/index.htm



2011/11/16 Shogo Sugamoto eseh...@gmail.com

 Hi,Cafe.

 I want to create my own Programming Language with Haskell, and I learn
 how to do it.
 I read:

 WikiBooks of Write Yourself a Scheme in 48 Hours,
 Real World Haskell of Chapter Using Parsec,
 Source of HJS,
 Book of Introduction of Functional Programming Using Haskell.

 Ok,What is another good source creating my own Programming Language
 with Haskell?
 Thanks :)

 esehara

 ___
 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] lazy A-star search

2011-10-31 Thread Anton Kholomiov
The last implementation is type-driven, so I'm trying
to understand it myself now in the light of your remark. Do you mean that
the problem
is this: to mergeBy things together I need to add the nodes to the set of
visited
nodes first? So I'm adding nodes to visited set before I've chosen the best
node.


31 октября 2011 г. 9:05 пользователь Eugene Kirpichov
ekirpic...@gmail.comнаписал:

 Anton, I think the mapM inside searchBy is incorrect. You're threading
 state between exploration of different branches, which you I think
 shouldn't be doing.



 30.10.2011, в 19:44, Anton Kholomiov anton.kholom...@gmail.com
 написал(а):

 I'm misunderstanding astar. I've thought that 'whole route'-heuristic
 will prevent algorithm from going in circles. The more you circle around
 the more the whole route distance is. Thank you for showing this.
 Here is an updated version. searchBy function contains a state.
 State value accumulates visited nodes:

 -- | Heuristic search. Nodes are visited from smaller to greater.
 searchBy :: Ord b = (a - b) - (a - a - Ordering) - Tree a - [a]
 searchBy f heur t = evalState (searchBy' f heur t) S.empty

 searchBy' :: Ord b
 = (a - b) - (a - a - Ordering) - Tree a - State (S.Set b) [a]
 searchBy' f heur (Node v ts) = get = phi
 where phi visited
 | S.member (f v) visited = return []
 | otherwise  =
 put (S.insert (f v) visited) 
 (v :) . foldr (mergeBy heur) [] $
 mapM (searchBy' f heur) ts

 I need to add function Ord b = (a - b). It
 converts tree nodes into visited nodes. I'm using it
 for saving distance-values alongside with nodes
 in astar algorithm.

 In attachment you can find algorithm with your example.

 2011/10/27 Ryan Ingram ryani.s...@gmail.com

 Also, this wasn't clear in my message, but the edges in the graph only go
 one way; towards the top/right; otherwise the best path is ABCDEHIJ :)


 On Thu, Oct 27, 2011 at 10:48 AM, Ryan Ingram ryani.s...@gmail.comwrote:

 You're missing one of the key insights from A-star (and simple djikstra,
 for that matter): once you visit a node, you don't have to visit it again.

 Consider a 5x2 2d graph with these edge costs:

 B 1 C 1 D 1 E 9 J
 1   1   1   1   1
 A 2 F 2 G 2 H 2 I

 with the start node being A, the target node being J, and the heuristic
 being manhattan distance.  Your search will always try to take the top
 route, on every node along the bottom path, even though you visit every
 node along the top route in your first try at reaching the goal.  You need
 a way to mark that a node is visited and remove it from future
 consideration, or else you're wasting work.

 A-star will visit the nodes in the order ABCDE FGHIJ; your algorithm
 visits the nodes in the order ABCDE FCDE GDE HE IJ.

   -- ryan

 On Sat, Oct 22, 2011 at 5:28 AM, Anton Kholomiov 
 anton.kholom...@gmail.com wrote:

 Recently I was looking for an A-star search algorithm. I've found a
 package
 but I couldn't understand the code. Then I saw some blogposts but they
  were difficult to understand too. I thought about some easier solution
 that
 relies on laziness. And I've come to this:

 Heuristic search is like depth-first search but solutions in sub-trees
 are concatenated with mergeBy function, that concatenates two
 list by specific order:

 module Search where

 import Control.Applicative
 import Data.Function(on)
 import Control.Arrow(second)
 import Data.Tree

 -- | Heuristic search. Nodes are visited from smaller to greater.
 searchBy :: (a - a - Ordering) - Tree a - [a]
 searchBy  heur (Node v ts) =
 v : foldr (mergeBy heur) [] (searchBy heur $ ts)

 -- | Merge two lists. Elements concatenated in specified order.
 mergeBy :: (a - a - Ordering) - [a] - [a] - [a]
 mergeBy _ a []  = a
 mergeBy _ []b   = b
 mergeBy p (a:as)(b:bs)
 | a `p` b == LT= a : mergeBy p as (b:bs)
 | otherwise = b : mergeBy p bs (a:as)


 Now we can define specific heuristic search in terms of searchBy:

 -- | Heuristic is distance to goal.
 bestFirst :: Ord h = (a - h) - (a - [a]) - a - [a]
 bestFirst dist alts =
 searchBy (compare `on` dist) . unfoldTree (\a - (a, alts a))

 -- | A-star search.
 -- Heuristic is estimated length of whole path.
 astar :: (Ord h, Num h) = (a - h) - (a - [(a, h)]) - a - [a]
 astar dist alts s0 = fmap fst $
 searchBy (compare `on` astarDist) $ unfoldTree gen (s0, 0)
 where astarDist (a, d) = dist a + d
   gen (a, d)  = d `seq` ((a, d), second (+d) $ alts a)

 I'm wondering is it effective enough?


 Anton

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




 Search.hs

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


___
Haskell-Cafe

Re: [Haskell-cafe] lazy A-star search

2011-10-30 Thread Anton Kholomiov
I'm misunderstanding astar. I've thought that 'whole route'-heuristic
will prevent algorithm from going in circles. The more you circle around
the more the whole route distance is. Thank you for showing this.
Here is an updated version. searchBy function contains a state.
State value accumulates visited nodes:

-- | Heuristic search. Nodes are visited from smaller to greater.
searchBy :: Ord b = (a - b) - (a - a - Ordering) - Tree a - [a]
searchBy f heur t = evalState (searchBy' f heur t) S.empty

searchBy' :: Ord b
= (a - b) - (a - a - Ordering) - Tree a - State (S.Set b) [a]
searchBy' f heur (Node v ts) = get = phi
where phi visited
| S.member (f v) visited = return []
| otherwise  =
put (S.insert (f v) visited) 
(v :) . foldr (mergeBy heur) [] $
mapM (searchBy' f heur) ts

I need to add function Ord b = (a - b). It
converts tree nodes into visited nodes. I'm using it
for saving distance-values alongside with nodes
in astar algorithm.

In attachment you can find algorithm with your example.

2011/10/27 Ryan Ingram ryani.s...@gmail.com

 Also, this wasn't clear in my message, but the edges in the graph only go
 one way; towards the top/right; otherwise the best path is ABCDEHIJ :)


 On Thu, Oct 27, 2011 at 10:48 AM, Ryan Ingram ryani.s...@gmail.comwrote:

 You're missing one of the key insights from A-star (and simple djikstra,
 for that matter): once you visit a node, you don't have to visit it again.

 Consider a 5x2 2d graph with these edge costs:

 B 1 C 1 D 1 E 9 J
 1   1   1   1   1
 A 2 F 2 G 2 H 2 I

 with the start node being A, the target node being J, and the heuristic
 being manhattan distance.  Your search will always try to take the top
 route, on every node along the bottom path, even though you visit every
 node along the top route in your first try at reaching the goal.  You need
 a way to mark that a node is visited and remove it from future
 consideration, or else you're wasting work.

 A-star will visit the nodes in the order ABCDE FGHIJ; your algorithm
 visits the nodes in the order ABCDE FCDE GDE HE IJ.

   -- ryan

 On Sat, Oct 22, 2011 at 5:28 AM, Anton Kholomiov 
 anton.kholom...@gmail.com wrote:

 Recently I was looking for an A-star search algorithm. I've found a
 package
 but I couldn't understand the code. Then I saw some blogposts but they
  were difficult to understand too. I thought about some easier solution
 that
 relies on laziness. And I've come to this:

 Heuristic search is like depth-first search but solutions in sub-trees
 are concatenated with mergeBy function, that concatenates two
 list by specific order:

 module Search where

 import Control.Applicative
 import Data.Function(on)
 import Control.Arrow(second)
 import Data.Tree

 -- | Heuristic search. Nodes are visited from smaller to greater.
 searchBy :: (a - a - Ordering) - Tree a - [a]
 searchBy  heur (Node v ts) =
 v : foldr (mergeBy heur) [] (searchBy heur $ ts)

 -- | Merge two lists. Elements concatenated in specified order.
 mergeBy :: (a - a - Ordering) - [a] - [a] - [a]
 mergeBy _ a []  = a
 mergeBy _ []b   = b
 mergeBy p (a:as)(b:bs)
 | a `p` b == LT= a : mergeBy p as (b:bs)
 | otherwise = b : mergeBy p bs (a:as)


 Now we can define specific heuristic search in terms of searchBy:

 -- | Heuristic is distance to goal.
 bestFirst :: Ord h = (a - h) - (a - [a]) - a - [a]
 bestFirst dist alts =
 searchBy (compare `on` dist) . unfoldTree (\a - (a, alts a))

 -- | A-star search.
 -- Heuristic is estimated length of whole path.
 astar :: (Ord h, Num h) = (a - h) - (a - [(a, h)]) - a - [a]
 astar dist alts s0 = fmap fst $
 searchBy (compare `on` astarDist) $ unfoldTree gen (s0, 0)
 where astarDist (a, d) = dist a + d
   gen (a, d)  = d `seq` ((a, d), second (+d) $ alts a)

 I'm wondering is it effective enough?


 Anton

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






Search.hs
Description: Binary data
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] lazy A-star search

2011-10-22 Thread Anton Kholomiov
Recently I was looking for an A-star search algorithm. I've found a package
but I couldn't understand the code. Then I saw some blogposts but they
 were difficult to understand too. I thought about some easier solution that
relies on laziness. And I've come to this:

Heuristic search is like depth-first search but solutions in sub-trees
are concatenated with mergeBy function, that concatenates two
list by specific order:

module Search where

import Control.Applicative
import Data.Function(on)
import Control.Arrow(second)
import Data.Tree

-- | Heuristic search. Nodes are visited from smaller to greater.
searchBy :: (a - a - Ordering) - Tree a - [a]
searchBy  heur (Node v ts) =
v : foldr (mergeBy heur) [] (searchBy heur $ ts)

-- | Merge two lists. Elements concatenated in specified order.
mergeBy :: (a - a - Ordering) - [a] - [a] - [a]
mergeBy _ a []  = a
mergeBy _ []b   = b
mergeBy p (a:as)(b:bs)
| a `p` b == LT= a : mergeBy p as (b:bs)
| otherwise = b : mergeBy p bs (a:as)


Now we can define specific heuristic search in terms of searchBy:

-- | Heuristic is distance to goal.
bestFirst :: Ord h = (a - h) - (a - [a]) - a - [a]
bestFirst dist alts =
searchBy (compare `on` dist) . unfoldTree (\a - (a, alts a))

-- | A-star search.
-- Heuristic is estimated length of whole path.
astar :: (Ord h, Num h) = (a - h) - (a - [(a, h)]) - a - [a]
astar dist alts s0 = fmap fst $
searchBy (compare `on` astarDist) $ unfoldTree gen (s0, 0)
where astarDist (a, d) = dist a + d
  gen (a, d)  = d `seq` ((a, d), second (+d) $ alts a)

I'm wondering is it effective enough?


Anton


Search.hs
Description: Binary data
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] lazy A-star search

2011-10-22 Thread Anton Kholomiov
Sorry for my English.
I mean can be used in practice, no only for toy examples

2011/10/22 Richard Senington sc06...@leeds.ac.uk

 **
 How do you mean effective?

 While I am not sure they mention A* search, you might like to look at the
 paper
 Modular Lazy Search for Constraint Satisfaction Problems by Nordin 
 Tolmach.
 http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.4704

 RS


 On 22/10/11 13:28, Anton Kholomiov wrote:

 Recently I was looking for an A-star search algorithm. I've found a
 package
 but I couldn't understand the code. Then I saw some blogposts but they
  were difficult to understand too. I thought about some easier solution
 that
 relies on laziness. And I've come to this:

  Heuristic search is like depth-first search but solutions in sub-trees
 are concatenated with mergeBy function, that concatenates two
 list by specific order:

  module Search where

  import Control.Applicative
 import Data.Function(on)
 import Control.Arrow(second)
 import Data.Tree

  -- | Heuristic search. Nodes are visited from smaller to greater.
 searchBy :: (a - a - Ordering) - Tree a - [a]
 searchBy  heur (Node v ts) =
 v : foldr (mergeBy heur) [] (searchBy heur $ ts)

  -- | Merge two lists. Elements concatenated in specified order.
 mergeBy :: (a - a - Ordering) - [a] - [a] - [a]
 mergeBy _ a []  = a
 mergeBy _ []b   = b
 mergeBy p (a:as)(b:bs)
 | a `p` b == LT= a : mergeBy p as (b:bs)
 | otherwise = b : mergeBy p bs (a:as)


  Now we can define specific heuristic search in terms of searchBy:

  -- | Heuristic is distance to goal.
 bestFirst :: Ord h = (a - h) - (a - [a]) - a - [a]
 bestFirst dist alts =
 searchBy (compare `on` dist) . unfoldTree (\a - (a, alts a))

  -- | A-star search.
 -- Heuristic is estimated length of whole path.
 astar :: (Ord h, Num h) = (a - h) - (a - [(a, h)]) - a - [a]
 astar dist alts s0 = fmap fst $
 searchBy (compare `on` astarDist) $ unfoldTree gen (s0, 0)
 where astarDist (a, d) = dist a + d
   gen (a, d)  = d `seq` ((a, d), second (+d) $ alts a)

  I'm wondering is it effective enough?


  Anton


 ___
 Haskell-Cafe mailing 
 listHaskell-Cafe@haskell.orghttp://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] library on common sub-expression elimination?

2011-08-12 Thread Anton Kholomiov
Just to make it explicit, is it

 \a i -
 let t = a ! i in
 if i = 0 then
t
 else if i  0 then
t + a ! (i-1)
 else 

bad idea, because of last else-case? Can it be mended with
one another pass  for if-expressions?

The upcoming distilled tutorial at DSL 2011 - thank you for the link.

I'm going to experiment with data-reify, while the library you've mentioned
is
OCaml only.


2011/8/12 o...@okmij.org


 I guess you mean the function that converts an abstract syntax tree to
 a directed acyclic graph (DAG).

 Just for completeness I should mention that if the object language has
 effects including non-termination, one has to be careful eliminating
 seemingly common expressions. For example, in

\a i -
  if i = 0 then
 a ! i
  else if i  0 then
 a ! i + a ! (i-1)
  else 

 we see the expression (a ! i) repeated in both branches of
 the conditional. Eliminating the `duplicate' by pulling it out

\a i -
  let t = a ! i in
  if i = 0 then
 t
  else if i  0 then
 t + a ! (i-1)
  else 

 would be wrong, wouldn't it?

 This issue has been extensively investigated in the Fortran compiler
 community; Elliott, Finne and de Moor's ``Compiling Embedded Languages''
 (JFP 2003) talks about it at length.


 The standard technique to detect occurrences of common subexpressions
 is so-called hash-consing. There are (OCaml) libraries for it:

  author= {Jean-Christophe Filli{\^a}tre and Sylvain Conchon},
  title = {Type-Safe Modular Hash-Consing},
  pages = {12--19},
  crossref  = ml2006,
  doi   = 10.1145/1159876.1159880,

 The upcoming distilled tutorial at DSL 2011

 http://dsl2011.bordeaux.inria.fr/index.php?option=com_contentview=articleid=2Itemid=2

 will present a Haskell library for hash-consing. The library can work
 with the standard Haskell Hash-tables or without them (using Data.Map,
 for example). The library does _not_ rely on Stable names and other
 internal GHC operations with unstable semantics. The library will find
 all common sub-expressions.


 Incidentally, despite the Lisp-sounding name, hash-consing was
 invented before Lisp. It was described, for the English audience, in
 the first volume of Comm. ACM, in 1958:

 @Article{   Ershov-hash-consing,
  author= {A. P. Ershov},
  title = {On programming of arithmetic operations},
  journal   = Communications of the {ACM},
  year  = 1958,
  volume= 1,
  number= 8,
  pages = {3--6},
  doi   =10.1145/368892.368907,
  url   = http://portal.acm.org/citation.cfm?id=368907;
 }

 The translation is quite accurate, as far as I could see, but misses
 the flowcharts and the diagram of the original paper. This short paper
 fully describes what we now call hash tables, hash functions, useful
 properties of hash functions, and hash-consing. The article analyzes
 the time complexity of the algorithm. Since the algorithm has two
 exits, writing programs in the continuation-passing style must have been
 familiar back then.


 The library to be presented at DSL 2011 unwittingly follows Ershov's
 algorithm closely. The library is (hopefully) better described (see
 the preface to the English translation of Ershov's paper). Nowadays,
 starting a paper with the phrase ``All unexplained terms are those
 from [1]'' (where [1] is the single reference) would not be taken
 kindly by reviewers.


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


Re: [Haskell-cafe] library on common sub-expression elimination?

2011-08-12 Thread Anton Kholomiov
Do you mean that x and y in

x = a + 1
y = a + 1

are different from data-reify point of view?

2011/8/12 Conal Elliott co...@conal.net

 Note that data-reify will only find *some* common/equal sub-expressions,
 namely the pointer-equal ones. In all of my code-generating (deep) DSLs,
 it's been very important for efficiency to also pull out
 equal-but-pointer-unequal expressions.

- Conal


 On Thu, Aug 11, 2011 at 4:41 AM, Vo Minh Thu not...@gmail.com wrote:

 I guess you refer to data-reify:
 http://hackage.haskell.org/package/data-reify

 2011/8/11 Stephen Tetley stephen.tet...@gmail.com:
  Strafunski and its successors (Uniplate, SYB, KURE) are really for
  working on trees. If you want to work on graphs you would probably be
  better of with something else.
 
  I think I overlooked that you want common sub-expression
  _elimination_, rather than expression simplification. There are
  libraries for observable sharing (Andy Gill's recent one is the
  state-of-the-art, its on Hackage but I've forgotten its name) - that
  are pertinent where you have built the expressions as an embedded DSL
  in Haskell and you want sharing in code you generate from the Haskell
  DSL.
 
 
 
  On 11 August 2011 08:57, Anton Kholomiov anton.kholom...@gmail.com
 wrote:
  Thank you for the reference to Strafunski libraries, I read
  HaskellWiki, but I don't have a permission to visit their site.
  All links are forbidden.
 
  Can it be a function:
 
  fun :: Eq a = Tree a - [(Int, (a, [Int]))]
 
  where tuple codes nodes, and Int's code edges.
 
  2011/8/11 Stephen Tetley stephen.tet...@gmail.com
 
  Wouldn't this be dependent upon your AST and thus not readily
  package-able as a library?
 
  Expression simplification has been a prime example for Strafunski
  style traversal libraries. You might be able to find examples that you
  can adapt to your own AST written with Uniplate or similar library.
 
  On 11 August 2011 05:00, Anton Kholomiov anton.kholom...@gmail.com
  wrote:
   Is there a library on common sub-expression elimination?
  
 
  ___
  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 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] library on common sub-expression elimination?

2011-08-11 Thread Anton Kholomiov
Thank you for the reference to Strafunski libraries, I read
HaskellWiki, but I don't have a permission to visit their site.
All links are forbidden.

Can it be a function:

fun :: Eq a = Tree a - [(Int, (a, [Int]))]

where tuple codes nodes, and Int's code edges.

2011/8/11 Stephen Tetley stephen.tet...@gmail.com

 Wouldn't this be dependent upon your AST and thus not readily
 package-able as a library?

 Expression simplification has been a prime example for Strafunski
 style traversal libraries. You might be able to find examples that you
 can adapt to your own AST written with Uniplate or similar library.

 On 11 August 2011 05:00, Anton Kholomiov anton.kholom...@gmail.com
 wrote:
  Is there a library on common sub-expression elimination?
 

 ___
 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] library on common sub-expression elimination?

2011-08-10 Thread Anton Kholomiov
Is there a library on common sub-expression elimination?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Split function

2011-02-09 Thread Anton Kholomiov
There is a 'spit' library on hackage. Maybe you are looking for this

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


Re: [Haskell-cafe] [ANNOUNCE] csound-expression - csound combinator library

2010-11-11 Thread Anton Kholomiov
Maybe haskellWiki is proper place for this, but I like what haddock is doing
with styles and how it links to functions and modules.


2010/11/10 Erik de Castro Lopo mle...@mega-nerd.commle%2...@mega-nerd.com


 Anton Kholomiov wrote:

  no, it's not here any more, but i've added tutorial. look for update
 
  http://hackage.haskell.org/package/csound-expression

 Thanks for that, but wouldn't it be nicer to move the
 tutorial out of the library sources directoru src/ ?

 Cheers,
 Erik
 --
 --
 Erik de Castro Lopo
 http://www.mega-nerd.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


Re: [Haskell-cafe] [ANNOUNCE] csound-expression - csound combinator library

2010-11-09 Thread Anton Kholomiov
no, it's not here any more, but i've added tutorial. look for update

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




2010/11/4 C K Kashyap ckkash...@gmail.com

 Hi Erik,

  This looks very interesting and seems to have quite comprehensive
  reference documentation. Unfortunately there doesn't seem to be
  any examples.
 
  Would it be possible to add some examples? Even trivial ones would
  be useful to get people started.
 
  Erik

 The examples at the bottom of 'CsoundExpr.Base.Types' page might help

 --
 Regards,
 Kashyap
 ___
 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] [ANNOUNCE] csound-expression - csound combinator library

2010-10-26 Thread Anton Kholomiov
Hi,

I'm glad to announce csound combinator library.

It features liberation from id-style csound code, haskore-like composition
structures, type-safe composable opcodes and simple instrument interface (no
interface at all, instrument is just a function from some note
representation to signal).

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

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