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

2013-09-26 Thread aditya siram
Hi Conal,
I'm glad you're bringing this up. I am currently working on FLTK bindings (
github.com/deech/fltkhs). It's main advantage of this toolkit is that it
lets the user deploy apps as a self-contained binary on all platforms.

Right now the work consists of the tedium of binding Haskell to the
underlying C layer.

Any help with the grunt work or input on creating a nice Haskell API would
be appreciated. So far it seems as though wxHaskell is worth emulating but
I'm pretty open.

Thanks!
-deech


On Thu, Sep 26, 2013 at 10:32 PM, Conal Elliott  wrote:

> I'm polling to see whether there are will and expertise to reboot graphics
> and GUIs work in Haskell. I miss working on functional graphics and GUIs in
> Haskell, as I've been blocked for several years (eight?) due to the absence
> of low-level foundation libraries having the following properties:
>
> * cross-platform,
> * easily buildable,
> * GHCi-friendly, and
> * OpenGL-compatible.
>
> The last several times I tried Gtk2hs, I was unable to compile it on my
> Mac. Years ago when I was able to compile, the GUIs looked and interacted
> like a Linux app, which made them awkward and upleasant to use. wxHaskell
> (whose API and visual appearance I prefered) has for years been
> incompatible with GHCi, in that the second time I open a top-level window,
> the host process (GHCi) dies abruptly. Since my GUI & graphics programs are
> often one-liners, and I tend to experiment a lot, using a full compilation
> greatly thwarts my flow. For many years, I've thought that the situation
> would eventually improve, since I'm far from the only person who wants GUIs
> or graphics from Haskell.
>
> About three years ago, I built a modern replacement of my old Pan and
> Vertigo systems (optimized high-level functional graphics in 2D and 3D),
> generating screamingly fast GPU rendering code. I'd love to share it with
> the community, but I'm unable to use it even myself.
>
> Two questions:
>
> * Am I mistaken about the current status? I.e., is there a solution for
> Haskell GUI & graphics programming that satisfies the properties I'm
> looking for (cross-platform, easily buildable, GHCi-friendly, and
> OpenGL-compatible)?
> * Are there people willing and able to fix this situation? My own
> contributions would be to test and to share high-level composable and
> efficient GUI and graphics libraries on top of a working foundation.
>
> Looking forward to replies. Thanks,
>
> -- Conal
>
> ___
> 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] Creating a local Hoogle ...

2013-09-21 Thread aditya siram
Hi all,
I've installed Hoogle but am having issues creating the databases. I first
did: `hoogle data all`, tried a search `hoogle "[a] -> a" and got:
Could not find some databases: default
Searching in:
  .
~/.cabal/share/hoogle-4.2.21/databases

Either the package does not exist or has not been generated
Found 4263 databases, including: abacate abcnotation abortt-monadstf
abortt-mtl abortt-transformers

So to create th default database I did: `hoogle combine *.hoo` and then got:
Combining 4263 databases
hoogle: embroidery.hoo: openFile: resource exhausted (Too many open files)

Any help is appreciated. Thanks!

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


Re: [Haskell-cafe] FLTK GUI Binding in progress. Call for participation.

2013-09-09 Thread aditya siram
Thanks for your input.

However from an API coverage standpoint I think I further along than that
project. Also it hasn't been updated since 2008.

That said it seems to have a nice interface. Should I emulate that?

One of my main goals for starting this thread (besides getting help) was to
start a discussion about what the higher level abstraction should look
like. There's so many choices.

Thanks!
-deech


On Sun, Sep 8, 2013 at 8:20 PM, John Lask  wrote:

> On 9/09/2013 7:09 AM, aditya siram wrote:
>
>> Hi all,
>> I'm working on a FLTK [1] GUI binding [2]. The attraction of FLTK is that
>>
>
> there is an existing binding on hackage:
>
> "hs-fltk library: Binding to GUI library FLTK"
>
>
> which I understand is quite serviceable. Perhaps effort could be directed
> on making improvements (should they be required) to this rather than
> duplicating existing functionality.
>
>
>
> __**_
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/**mailman/listinfo/haskell-cafe<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] FLTK GUI Binding in progress. Call for participation.

2013-09-08 Thread aditya siram
Hi all,
I'm working on a FLTK [1] GUI binding [2]. The attraction of FLTK is that
it is portable across many platforms, meaning it is easy to:
1. provide a binary for your application that works without installing
anything else. eg. no need to install X on Mac. Just double-click!
2. develop on other platforms because both the library and the bindings
have few dependencies and compile from scratch without a fuss.
3. provide native solutions that don't require the browser.

To my knowledge no current bindings have all those advantages.

Most of the work of wrapping the C++ in C is done and a number of the
examples that ship with FLTK have been ported to C and seem to be
compatible.

I have only just started the Haskell bindings.

This is a great time to:
1. help with the low-level porting. Most of it is just busy work.
2. significantly influence what the Haskelly abstraction layer will look
like.
3. tell me if I'm doing something wrong in the C/C++ code. I'm a newbie to
both languages. I've learned what I needed to know to get this far.

Thanks for your attention.
-deech

[1] http://www.fltk.org/index.php
[2] http://github.com/deech/fltkhs
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Origin of Delimited Continuation Operators

2012-06-24 Thread aditya siram
Hi all,
I working through a few papers and Oleg's delimited continuation
implementation and I'm wondering how the operators (shift, shift0P,
control, reset, etc) got their name.
-deech

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


Re: [Haskell-cafe] A Mascot

2011-11-16 Thread aditya siram
Wonder what they'd make of "bottom" :)

Maybe we can also incorporate some tongue-in-cheek tip-of-the-hat to
Shakespeare :
http://www.shakespearesantacruz.org/about/images/dream_34_thaler_web.jpg

-deech

On Wed, Nov 16, 2011 at 6:50 PM, Tom Murphy  wrote:

> I'm used to (on the east coast US) hearing lambda pronounced "LAM-duh."
> "Duh" is an expression of something being stupid, so I don't know about
> Haskell having a mascot called "Duh the Lamb"!
>
> amindfv / Tom
> On Nov 16, 2011 4:06 PM, "heathmatlock"  wrote:
>
>>
>>
>> On Wed, Nov 16, 2011 at 5:54 AM, Jerzy Karczmarczuk <
>> jerzy.karczmarc...@unicaen.fr> wrote:
>>
>>> Do you mind some ... how to say ... offside comments?
>>>
>>> 1. The Curry Da mascot looks like a penguin disguised as a  lamb. I have
>>> nothing against penguins !
>>>
>>
>> Hi Jerry, thanks for your input. The reason to have the the lamb standing
>> up is just so he can be dressed, and it does have similarities to a penguin
>> with its round belly, I suppose.
>>
>>>
>>> 2. Da, da, konech'no, mais, Signori und Demoiselles, do you realize that
>>> "lamb" is an English word, and we should think about our multilingual
>>> society. with our agneaux and other Karakuls. You will have problems with
>>> the translation of the mascot into German, and some may find some analogies
>>> with another image:
>>> http://www.chrisrusak.com/**images/11-013_small.jpg
>>> called  "Ein liebliches Lämmlein zu Tod" (after Des Knaben Wunderhorn,
>>> in the last part of Mahler 4th Symphony).
>>>
>>> 3. On the other hand, from the cultural point of view, this is a very
>>> good idea, and quite international, everybody knows Lamb Curry (Rogan Josh):
>>> http://www.route79.com/food/**rogan-josh.htm
>>>
>>>
>> Some might picture a symphony or what looks like newspaper origami when
>> they hear Da, and some might picture food when they hear Curry. I like Da
>> because its simple and "Da the lamb" rolls smoothly off the tongue.
>> Probably best to open a poll to and let everyone decide.
>>
>>
>> --
>> Heath Matlock
>> +1 256 274 4225
>>
>> ___
>> 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] Label macro expansion bug In HList.

2011-11-11 Thread aditya siram
Awesome! The samples now work. Thanks so much for your help.
-deech

On Fri, Nov 11, 2011 at 11:14 PM,  wrote:

>
> > The reason I commented out the Data.HList.TypeEqO was because I
> > couldn't find it.
>
> My apologies! It turns out I have forgotten to 'darcs add' it. It is
> committed now:
>http://code.haskell.org/HList/Data/HList/TypeEqO.hs
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Label macro expansion bug In HList.

2011-11-11 Thread aditya siram
Thanks for updating the Cabal file. The reason I commented out the
Data.HList.TypeEqO was because I couldn't find it. I grepped the HList
source tree for it and I found references to it only in the following
places:
./Data/HList/RecordD.hs:import Data.HList.TypeEqO
./examples/TIPTransform.hs:import Data.HList.TypeEqO
./examples/MainGhcGeneric1.hs: module Data.HList.TypeEqO,
./examples/MainGhcGeneric1.hs:import Data.HList.TypeEqO
./examples/MainPatternMatch.hs:import Data.HList.TypeEqO
./examples/TIPTransformM.hs:import Data.HList.TypeEqO
./HList.cabal: Data.HList.HListPrelude,
Data.HList.TypeEqO,

I couldn't find it on Hoogle or Hayoo either. Am I missing something?

-deech

On Fri, Nov 11, 2011 at 10:25 PM,  wrote:

>
> > I have verified that the issue with the "makeLabels" function goes away
> if
> > I install 7.0.4.
>
> I'm glad to hear that. GHC 7.0.4 has updated Template Haskell in
> backward-incopatible ways.
>
> > I got an extremely large error (~ 5000 lines) when loading
> > "OCamlTutorial.hs".
>
> Quite likely the reason was the Data.HList.TypeEqO import that you
> have commented out. Data.HList.TypeEqO is really needed. I have
> pushed the changed HList.cabal. (I must admit I use HList without
> cabal-installing it: I simply arrange OOHaskell and HList as sibling
> subdirectories. See OOHaskell/samples/Makefile).
>
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Label macro expansion bug In HList.

2011-11-11 Thread aditya siram
I have verified that the issue with the "makeLabels" function goes away if
I install 7.0.4. I got an extremely large error (~ 5000 lines) when loading
"OCamlTutorial.hs". When I've parsed through it, I'll post back. Sorry for
the confusion.
-deech

On Fri, Nov 11, 2011 at 1:33 PM, aditya siram wrote:

> I also have the same issue with OOHaskell after pulling from
> http://code.haskell.org/OOHaskell. After loading GHCI I did:
> > :l ../samples/OCamlTutorial.hs
> ../samples/OCamlTutorial.hs:97:3:
> Multiple declarations of `foo'
> Declared at: ../samples/OCamlTutorial.hs:53:1
>  ../samples/OCamlTutorial.hs:97:3
>
> Failed, modules loaded: OOHaskell, Dynamic, Print, DeepNarrow, Nominal,
> New.
>
>
> Also in the beginning I was unable to load lib/OOHaskell.hs into GHCI
> because it tried to import a module that was no-longer exported by HList
> "Data.HList.TypeEq0". When I commented out that line, it loaded fine into
> GHCI.
>
> -deech
>
>
> On Fri, Nov 11, 2011 at 1:20 PM, aditya siram wrote:
>
>> I just pulled the latest version of HList :
>> > darcs clone http://code.haskell.org/HList
>>
>> I compiled it with GHC 7.2.1 and I am still running into the same issue
>> the "makeLabels" function:
>> > runQ (makeLabels ["test1","test2"]) >>= putStrLn . pprint
>>
>> data Foo_0 deriving (Data.Typeable.Internal.Typeable)
>> foo_1 = Data.HList.FakePrelude.proxy :: Data.HList.FakePrelude.Proxy Foo_0
>>  data Foo_2 deriving (Data.Typeable.Internal.Typeable)
>> foo_3 = Data.HList.FakePrelude.proxy :: Data.HList.FakePrelude.Proxy Foo_2
>>
>> Also the cabal file that is currently at the tip of the repository
>> includes some of the files that have been moved into the "obsolete"
>> directory. I have attached an updated HList.cabal file that seems to work
>> on my machine.
>>
>> Thanks!
>> -deech
>>
>>
>>
>> On Tue, Nov 8, 2011 at 8:16 PM,  wrote:
>>
>>>
>>> I believe this is the case of OOHaskell gotten a bit out of sync with
>>> HList and GHC. Please use the latest code bases
>>>
>>>http://code.haskell.org/HList
>>>http://code.haskell.org/OOHaskell
>>>
>>> OCamlTutorial and all other OOHaskell code should work (with GHC
>>> 7.0.4).
>>>
>>>
>>>
>>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Label macro expansion bug In HList.

2011-11-11 Thread aditya siram
I also have the same issue with OOHaskell after pulling from
http://code.haskell.org/OOHaskell. After loading GHCI I did:
> :l ../samples/OCamlTutorial.hs
../samples/OCamlTutorial.hs:97:3:
Multiple declarations of `foo'
Declared at: ../samples/OCamlTutorial.hs:53:1
 ../samples/OCamlTutorial.hs:97:3
Failed, modules loaded: OOHaskell, Dynamic, Print, DeepNarrow, Nominal, New.


Also in the beginning I was unable to load lib/OOHaskell.hs into GHCI
because it tried to import a module that was no-longer exported by HList
"Data.HList.TypeEq0". When I commented out that line, it loaded fine into
GHCI.

-deech

On Fri, Nov 11, 2011 at 1:20 PM, aditya siram wrote:

> I just pulled the latest version of HList :
> > darcs clone http://code.haskell.org/HList
>
> I compiled it with GHC 7.2.1 and I am still running into the same issue
> the "makeLabels" function:
> > runQ (makeLabels ["test1","test2"]) >>= putStrLn . pprint
>
> data Foo_0 deriving (Data.Typeable.Internal.Typeable)
> foo_1 = Data.HList.FakePrelude.proxy :: Data.HList.FakePrelude.Proxy Foo_0
> data Foo_2 deriving (Data.Typeable.Internal.Typeable)
> foo_3 = Data.HList.FakePrelude.proxy :: Data.HList.FakePrelude.Proxy Foo_2
>
> Also the cabal file that is currently at the tip of the repository
> includes some of the files that have been moved into the "obsolete"
> directory. I have attached an updated HList.cabal file that seems to work
> on my machine.
>
> Thanks!
> -deech
>
>
>
> On Tue, Nov 8, 2011 at 8:16 PM,  wrote:
>
>>
>> I believe this is the case of OOHaskell gotten a bit out of sync with
>> HList and GHC. Please use the latest code bases
>>
>>http://code.haskell.org/HList
>>http://code.haskell.org/OOHaskell
>>
>> OCamlTutorial and all other OOHaskell code should work (with GHC
>> 7.0.4).
>>
>>
>>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Label macro expansion bug In HList.

2011-11-11 Thread aditya siram
I just pulled the latest version of HList :
> darcs clone http://code.haskell.org/HList

I compiled it with GHC 7.2.1 and I am still running into the same issue the
"makeLabels" function:
> runQ (makeLabels ["test1","test2"]) >>= putStrLn . pprint
data Foo_0 deriving (Data.Typeable.Internal.Typeable)
foo_1 = Data.HList.FakePrelude.proxy :: Data.HList.FakePrelude.Proxy Foo_0
data Foo_2 deriving (Data.Typeable.Internal.Typeable)
foo_3 = Data.HList.FakePrelude.proxy :: Data.HList.FakePrelude.Proxy Foo_2

Also the cabal file that is currently at the tip of the repository includes
some of the files that have been moved into the "obsolete" directory. I
have attached an updated HList.cabal file that seems to work on my machine.

Thanks!
-deech


On Tue, Nov 8, 2011 at 8:16 PM,  wrote:

>
> I believe this is the case of OOHaskell gotten a bit out of sync with
> HList and GHC. Please use the latest code bases
>
>http://code.haskell.org/HList
>http://code.haskell.org/OOHaskell
>
> OCamlTutorial and all other OOHaskell code should work (with GHC
> 7.0.4).
>
>
>


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


[Haskell-cafe] Label macro expansion bug In HList.

2011-11-08 Thread aditya siram
Hi all,
I am exploring OOHaskell and ran into some compilation issues with some of
the samples. I hope this is the right place to report it.

For example "OCamlTutorial.hs" generates the following error:
../samples/OCamlTutorial.hs:98:3:
Multiple declarations of `foo'
Declared at: ../samples/OCamlTutorial.hs:54:1
 ../samples/OCamlTutorial.hs:98:3
Failed, modules loaded: OOHaskell, Dynamic, Print, DeepNarrow, Nominal, New.

This is happening because the "label" macro on line 98:
$(label "varX")
doesn't expand correctly and clashes with the "foo" function on line 54:
foo f = f # field1

The "label" function is found in the Data.HList.MakeLabels module and
should work this way according to the docs:
> runQ (label "test") >>= putStrLn . pprint
data Test deriving (Data.Typeable.Internal.Typeable)
test = Data.HList.FakePrelude.proxy :: Data.HList.FakePrelude.Proxy Test

But I get:
data Foo_0 deriving (Data.Typeable.Internal.Typeable)
foo_1 = Data.HList.FakePrelude.proxy :: Data.HList.FakePrelude.Proxy Foo_0

This still doesn't cleanly explain why "OCamlTutorial.hs" is failing since
it seems to be generating unique datatypes and functions by suffixing them
with a number, but it seems to point to the problem. I'm hoping someone who
knows HList better might understand it better.

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


Re: [Haskell-cafe] hello Haskell

2011-10-23 Thread aditya siram
I don't think OP realizes that we *avoid* success at all costs.
-deech

On Sun, Oct 23, 2011 at 9:17 PM, Tom Murphy  wrote:
> The GUI list could definitely use this type of moderation.
>
> Tom / amindfv
>
> On Oct 23, 2011 9:54 PM, "Erik de Castro Lopo"  wrote:
>>
>> R J wrote:
>>
>> > hey Haskell this is nuts http://www.business10i.com
>> > hey Haskell this is nuts ://xxx.xxx.xxx
>>
>> Maybe its time to moderate all newcomers to this list, at least
>> until they post one non-spam message to the list.
>>
>> If you need volunteers to do this moderation I'll stick my hand up.
>>
>> 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
>
>

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


Re: [Haskell-cafe] Message

2011-10-21 Thread aditya siram
Non snarky question - what does it need?
-deech

On Fri, Oct 21, 2011 at 12:51 PM, Albert Y. C. Lai  wrote:
> On 11-10-21 03:59 AM, Ivan Lazar Miljenovic wrote:
>>
>> 2011/10/21 Goutam Tmv:
>>>
>>> Would you ever see yourself write a web application like Twitter or
>>> Facebook
>>> in Haskell?
>>
>> No.  But then, I wouldn't write a web application like either of them
>> in _any_ language.
>
> +1
>
> The world does not need another Twitter, another Facebook, another Reddit,
> another graphics engine, another database system, or another operating
> system.
>
> ___
> 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] Truly Really Off-topic: (Was: Mathematics)

2011-08-29 Thread aditya siram
I'm afraid you're going to have a lot of OCD's completely miss the point of
your email and annoy you with comments about the quote which you'll then
have to refute.

I'd actually stick with the old comment, remove it completely, include a
short summary with a link to the paper or attribute it to Abe Lincoln.

-deech

On Mon, Aug 29, 2011 at 11:08 AM, Jack Henahan  wrote:

> Better?
>
> Jack Henahan
> jhena...@uvm.edu
> ==
> Computer science is no more about computers than astronomy is about
> telescopes….
> -- Michael R. Fellows and Ian Parberry
> ==
>
>
>
>
> On Aug 29, 2011, at 11:47 AM, Gwern Branwen wrote:
>
> >> Michael R. Fellows and Ian Parberry
>
>
> ___
> 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] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-27 Thread aditya siram
http://www.youtube.com/watch?v=Y_exermAXkU&t=0m6s

-deech

On Sat, Aug 27, 2011 at 4:56 PM, Daniel Patterson
wrote:

> That doesn't look very promising :(
>
> On Aug 27, 2011, at 5:31 PM, Daniel Fischer wrote:
>
> > On Saturday 27 August 2011, 23:10:17, David Virebayre wrote:
> >> 2011/8/27 aditya siram :
> >>> Hi all,
> >>> I would like for the GHCI interpreter to save its environment before
> >>> reloading a file and allowed the user to revert back to that state if
> >>> the compilation was unsuccessful.
> >>
> >> That would be awesome. I would like this too.
> >
> > http://hackage.haskell.org/trac/ghc/ticket/1896
> >
> >
> > ___
> > 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] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-27 Thread aditya siram
Hi all,
I would like for the GHCI interpreter to save its environment before
reloading a file and allowed the user to revert back to that state if the
compilation was unsuccessful.

Many times I've changed files, loaded them, hit a compilation error and
needed, for example, the inferred type signature of some function. Even
though that function hasn't been changed I have to either fix my code, undo
a bunch of changes or comment out the last change I made and reload in order
to do a ":type" on the function. This really breaks the flow of development.


Thanks for considering.

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


Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread aditya siram
I just had a problem closely related to this on StackOverflow [1]
which was explained beautifully by cammcann.

The problem is that because "type CPUFunc cpu" is located inside the
definition of the class "CPU" it creates the illusion that they are
somehow tied together where "CPUFunc" is somehow in the "CPU"
namespace. It isn't. "CPUFunc" is actually defined globally and the
compiler would complain if you tried to create a CPUFunc type anywhere
else in your code.

The solution is the make "CPUFunc" a brand new datatype by changing
"type CPUFunc cpu" to "data CPUFunc cpu" .

-deech


[1] 
http://stackoverflow.com/questions/6663547/writing-a-function-polymorphic-in-a-type-family

On Fri, Jul 22, 2011 at 10:12 AM, Serguey Zefirov  wrote:
> Why does GHC complains on the code below ? (I'll explain in a second a
> requirement to do just so)
>
> I get errors with ghc 6.12.1 and 7.0.2.
>
> -
> {-# LANGUAGE GADTs, TypeFamilies #-}
>
> class CPU cpu where
>        type CPUFunc cpu
>
> data Expr cpu where
>        EVar :: String -> Expr cpu
>        EFunc :: CPU cpu => CPUFunc cpu -> Expr cpu
>
> class CPU cpu => FuncVars cpu where
>        funcVars :: CPUFunc cpu -> [String]
>
> exprVars :: FuncVars cpu => Expr cpu -> [String]
> exprVars (EVar v) = [v]
> -- an offending line:
> exprVars (EFunc f) = funcVars f
> -
>
> I tried to split creation and analysis constraints. CPU required for
> creation of expressions, FuncVars required for analysis. It all looks
> nice but didn't work.
>
> (In our real code EVar is slightly more complicated, featuring "Var
> cpu" argument)
>
> It looks like GHC cannot relate parameters "inside" and "outside" of
> GADT constructor.
>
> Not that I hesitate to add a method to a CPU class, but I think it is
> not the right thing to do. So if I can split my task into two classes,
> I will feel better.
>
> ___
> 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] How to implement the mean function

2011-06-30 Thread aditya siram
What compiler errors are you getting?
-deech

On Fri, Jul 1, 2011 at 12:55 AM, Ruohao Li  wrote:
> Hi guys,
> I just started learning some Haskell. I want to implement a mean function to
> compute the mean of a list. The signature of the function is:
> mean :: (Num a, Fractional b) => [a] -> b
> But when I implement this simple function, the compiler keep whining at me
> on type errors. I know this is wrong:
> mean xs = sum xs / length xs
> But how to get it right? 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] overloading show function

2011-06-29 Thread aditya siram
Try enabling OverlappingInstances extension by adding this to the top
of the file:
{-# LANGUAGE OverlappingInstances #-}

-deech

On Wed, Jun 29, 2011 at 4:50 PM, Philipp Schneider
 wrote:
> Hi cafe,
>
> in my program i use a monad of the following type
>
> newtype M a = M (State -> (a, State))
>
> i use the monad in two different ways. The type variable "a" can be a
> pair as in
>
> interp :: Term -> Environment -> M (Value,Environment)
>
> and it can be just a value as in
>
> type Environment = [(Name, Either Value (M Value))]
>
> now in any case when i print the monad, i just want to print the value
> and never the environment.
>
> More specific i want to use somthing like the following
>
> instance (Show a,Show b) => Show (M (a,b)) where
>   show (M f) = let ((v,_), s) = f 0 in
>     "Value: " ++ show v ++  " Count: " ++ show s
>
> instance Show a => Show (M a) where
>   show (M f) = let (v, s) = f 0 in
>     "Value: " ++ show v ++  " Count: " ++ show s
>
> however this gives me the following error message:
>
>    Overlapping instances for Show (M (Value, Environment))
>      arising from a use of `print'
>    Matching instances:
>      instance (Show a, Show b) => Show (M (a, b))
>        -- Defined at
> /home/phil/code/haskell/vorlesung/ue09/ue09-3c3.hs:78:10-42
>      instance Show a => Show (M a)
>        -- Defined at
> /home/phil/code/haskell/vorlesung/ue09/ue09-3c3.hs:82:10-29
>    In a stmt of an interactive GHCi command: print it
>
> Any ideas how to fix it? Thanks!
> Philipp
>
> ___
> 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] Delimited Continuations For Web Development?

2011-06-09 Thread aditya siram
Hi all,
Is anyone in the Haskell community doing web development using
delimited continuations? Oleg had a talk on it [1] using Ocaml and CGI
but I haven't heard of anyone taking it further.
-deech

[1]http://okmij.org/ftp/continuations/index.html#shift-cgi

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


Re: [Haskell-cafe] The Lisp Curse

2011-05-19 Thread aditya siram
I wonder if it would be useful to be able to download and use only necessary
modules from Hackage. This way if someone writes, say a superior XML parsing
API, and someone else has better generating API, the user can pull just
those modules , write the glue and have the best of both worlds.

On the upside this would:
1. Make for a smaller local cabal repository.
2. Mitigate the problem of having to compile a package that has
functionality you don't need. MissingH [1] is a good example.
3. Allow you to continue working even if one of the modules doesn't compile.
I recently ran into this with liboleg [2] where I only wanted Control.CCCXe,
but couldn't "cabal install" it on my system because one of the other
modules failed to compile.

-deech

[1] http://hackage.haskell.org/package/MissingH-1.1.0.3
[2] http://hackage.haskell.org/package/liboleg

On Thu, May 19, 2011 at 4:30 PM, Julian Porter
wrote:

> >  ultimately the ideal is to end up with one library that solves the
> problem well, which everybody can use.
> >
> >
>  Nonsense.  One library that everyone can use with either end up being so
> small in functionality that it's actually useless, or so general that either
> it requires tons and tons of boilerplate just to use it at all, or it's
> really about eight libraries rolled into one and so impossible to find your
> way around.  Whichever, it's not good.  The sweet spot is at the point of
> maximum tension between generality and simplicity.
> ___
> 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] Trying to return a map from State monad

2011-05-19 Thread aditya siram
The problem is that the "all@(w1:words)" pattern-match fails when "all" is
empty. The quick and dirty fix is:
import Control.Monad.State
import Data.Map
import Debug.Trace

type Prefix = (String,String)
type GeneratorState = State ((Map Prefix [String]),Prefix,[String])


non_word = "\n"

f key new old = new ++ old

buildMap :: GeneratorState (Map Prefix [String])
buildMap = do (mp,(pfx1,pfx2),all) <- get
  if (Prelude.null all)
then  {- No more words. Return final map (adding
non_word for prefix). -}
  return (insertWithKey' f (pfx1,pfx2) [non_word] mp)
else do {- Add word to map at prefix. Continue. -}
  put (insertWithKey' f (pfx1,pfx2) [head all] mp,
(pfx2,head all), tail all)
  buildMap

*Main>  fst $ runState buildMap (singleton ("\n","\n") [], ("\n","\n"),
["I","am","lost."])
fromList
[(("\n","\n"),["I"]),(("\n","I"),["am"]),(("I","am"),["lost."]),(("am","lost."),["\n"])]

A better one would be to write a helper function that correctly pattern
matched on the list.

-deech




On Thu, May 19, 2011 at 3:30 PM, michael rice  wrote:

> OK. Again, not sure what going on here. Pattern looks OK to me.
>
> Michael
>
> =
>
> import Control.Monad.State
> import Data.Map
>
> type Prefix = (String,String)
> type GeneratorState = State ((Map Prefix [String]),Prefix,[String])
>
>
> non_word = "\n"
>
> f key new old = new ++ old
>
> buildMap :: GeneratorState (Map Prefix [String])
> buildMap = do (mp,(pfx1,pfx2),all@(w1:words)) <- get
>   if (Prelude.null all)
> then  {- No more words. Return final map (adding non_word
> for prefix). -}
>   return (insertWithKey' f (pfx1,pfx2) [non_word] mp)
> else do {- Add word to map at prefix. Continue. -}
>   put (insertWithKey' f (pfx1,pfx2) [w1] mp, (pfx2,w1),
> words)
>   buildMap
>
> =
>
> *Main> :r
> [1 of 1] Compiling Main ( markov3.hs, interpreted )
> Ok, modules loaded: Main.
> *Main> fst $ runState buildMap (singleton ("\n","\n") [], ("\n","\n"),
> ["I","am","lost."])
> fromList *** Exception: Pattern match failure in do expression at
> markov3.hs:13:14-44
>
>
> --- On *Thu, 5/19/11, michael rice * wrote:
>
>
> From: michael rice 
>
> Subject: Re: [Haskell-cafe] Trying to return a map from State monad
> To: "Thedward Blevins" 
>
> Cc: haskell-cafe@haskell.org
> Date: Thursday, May 19, 2011, 12:41 PM
>
>
> Ok, I see I left out the "State" word.
>
> Should be:
> type GeneratorState = State (Map Prefix [String],Prefix,[String])
>
> Thanks,
>
> Michael
>
>
> --- On *Thu, 5/19/11, Thedward Blevins * wrote:
>
>
> From: Thedward Blevins 
> Subject: Re: [Haskell-cafe] Trying to return a map from State monad
> To: "michael rice" 
> Cc: haskell-cafe@haskell.org
> Date: Thursday, May 19, 2011, 12:22 PM
>
> On Thu, May 19, 2011 at 11:03, michael rice  wrote:
> > type GeneratorState = (Map Prefix [String],Prefix,[String])
>
> > buildMap :: GeneratorState (Map Prefix [String])
>
> You are trying to use a type alias (GeneratorState) as a type constructor.
>
> There may be other problems, but that leaps out.
>
>
> -Inline Attachment Follows-
>
>
> ___
> 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] Server hosting

2011-05-06 Thread aditya siram
Have you considered Dynamic DNS [1]? I haven't personally tried it but
a friend of mine told me it works pretty well.
-deech
[1] http://www.dyndns.com/services/dns/dyndns/

On Fri, May 6, 2011 at 1:07 PM, Andrew Coppin
 wrote:
> OK, so strictly this is unrelated to Haskell as such. However, there's
> enough people doing webby stuff with Haskell that some of you must have
> wanted to run your code on a real, Internet-accessible web server. So does
> anybody have any suggestions on which companies offer the most favourable
> tools / pricing?
>
> I currently have a website, but it supports only CGI *scripts* (i.e., Perl
> or PHP). It does not support arbitrary CGI *binaries*, which is what I'd
> want for Haskell. In fact, I don't have control over the web server at all;
> I just put content on there.
>
> The same provider can offer me a virtual server, but at 3x the price I'm
> currently paying. I simply cannot afford that kind of money just for silly
> toy projects.
>
> What does everybody else use?
>
> ___
> 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] Haskell User Group starter kit

2011-04-26 Thread aditya siram
Yes! This is a great idea.

I'm a Haskell enthusiast in St. Louis, MO, USA and have given numerous
talks on Haskell locally at Lambda Lounge[1], a catch-all groups for
functional programmers, and the St.Louis Perl Mongers[2].

I would love to have a dedicated Haskell User Group, but unfortunately
this town appears to run on the JVM and I haven't been able to drum up
too much interest by myself. I've also never started or run a user
group before and I am also not the greatest salesman so some pointers
on how to create a buzz would be helpful.

-deech

[1] lambdalounge.org
[2] http://stlouis.pm.org/

On Tue, Apr 26, 2011 at 12:47 PM, Eric Y. Kow  wrote:
> Hi all,
>
> We may be coming to a time where we start to see Haskell User Groups or
> Functional Programming clubs popping up all the over the place.  Maybe
> it's a good time to put our heads together and figure out what we can do
> to nurture these groups, to keep them going strong rather than fizzling
> out.
>
> One idea might be create some sort of Haskell User Group starter kit
> so that individual groups can hit the ground running with some
> concrete ideas.
>
>  http://www.haskell.org/haskellwiki/Haskell_User_Group
>
> My hope is that it would provide just enough material for a group to
> reach critical mass.  So just enough stuff to account for the different
> kinds of activities a HUG may want to do (eg. Coding Dojos vs Talks vs
> Reading Group), but not so much that HUGs feel intimidated or stifled.
>
> Have you started a HUG recently? Or are you thinking of starting one?
> Maybe you could contribute just one idea to the kit?  More welcome,
> of course :-)
>
> --
> Eric Kow 
> For a faster response, try +44 (0)1273 64 2905 or
> xmpp:ko...@jabber.fr (Jabber or Google Talk only)
>
> ___
> 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] Haskellers in St. Louis?

2011-03-31 Thread aditya siram
Hi all,
I'm looking to start a Haskell user group in St. Louis, MO. Anyone
Haskellers or people interested in learning Haskell around these
parts?

-deech

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


Re: [Haskell-cafe] ANN: Monad.Reader special Poetry and Fiction Edition

2011-03-16 Thread aditya siram
Knot-tying has a page [1].
-deech

[1] http://www.haskell.org/haskellwiki/Tying_the_Knot


On Wed, Mar 16, 2011 at 10:42 AM, Andrew Coppin
 wrote:
> On 16/03/2011 03:05 PM, Brent Yorgey wrote:
>
>> This kind of "knot-tying" approach is nice for static graphs.
>
> I think we should have a wiki page somewhere which explains what all the
> various Haskell-related terms mean. Terms like "typing the knot" and
> "finally tagless". (Not to mention "Oleg rating"...)
>
> ___
> 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] Parallel Haskell stories

2011-03-09 Thread aditya siram
A couple of years ago, Lambda Lounge [1] a local group of language
enthusiasts had a shootout [2] where you were supposed to implement a
simple vending machine [3] that took coins and dispensed candy.

With *very* little experience using Haskell I was able to implement a
vending machine server [4] that wrapped its candy and change stock in
a TVar so it took multiple concurrent requests and either dispensed
change/candy or block if there wasn't any stock. I think that STM's
ease of use impressed people.

If you're thinking of running the code, please let me know and I'll
get it working with a recent GHC.

-deech

[1] lambdalounge.org
[2] http://lambdalounge.org/2009/05/05/may-meeting/
[3] 
http://stllambdalounge.files.wordpress.com/2009/03/vendingmachinespecification.pdf
[4] 
http://patch-tag.com/r/deech2k/VendingMachine/snapshot/current/content/pretty/VendingMachine.hs


On Wed, Mar 9, 2011 at 11:50 AM, Christopher Done
 wrote:
> On 9 March 2011 17:18, Simon Peyton-Jones  wrote:
>>
>> I can't say a lot about any one example, obviously, but what would be
>> great would be
>>        - an idea of how Haskell helped (esp if you have a head to head
>> comparison)
>>        - code snippets that illustrate how lovely it all is
>>        - brief performance indicators
>> *Insight* is the key word.  I don't just want to say "Company X used
>> Haskell to do Y" because that doesn't convey any re-usable insights or
>> ideas.  What is the essence?
>
> For what it's worth… (I imagine you're looking for more speed-intensive
> projects, but I like talking about Haskell, so here goes) my pet project
> IRCd called Hulk[1]. I whipped up a simple IRCd in an evening, and then the
> next day we (the dev team where I work[4]) were using it!
> Each client runs as a lightweight thread. The initial version used MVars all
> over the place, basically imperative, typical sloppy "getting it done
> quickly" code. I rewrote it a couple days later so that only the code that
> accepts connections and responds on the sockets is impure (100~ lines), and
> all the main code is totally pure (700~ lines), written in a monad stack of
> reader (connection information), writer (replies) and state (user details)
> (I abuse them[2]). I wrote about 500 lines of the pure stuff before even
> running it, and it just worked.
> There is one MVar in the project, that holds a pure value of all the state,
> this along with totally pure code, which has the obvious benefits;
> testability, a kind of "transactional" isolation. Some things (like checking
> against a SHA1 encrypted password file) require IO, so I have a
> MonadProvider class[3], with methods for providing values that will be
> impurely-acquired in the real server, but while testing I can provide my own
> values in a pure Reader or whatnot (HUnit and even QuickCheck spring to
> mind).
> One benefit, which didn't occur to me until asked about it, is that I didn't
> have to think much about choosing to have a separate thread per client
> because threads are so light-weight, my (Common Lisper) colleague was taken
> aback, being used to only "expensive" OS threads. The process been running
> for the past three weeks and we use it for all our dev discussion and for
> displaying things from feeds with rss2irc like commits, service events,
> support tickets, etc. Not bad for a few evenings of hacking!
> Insights: (1) It's nice and actually practical to make everything pure apart
> from the truly non-pure things, the monad of which can be parametrized. (2)
> Use of light-weight threads feels very natural, letting you think as if
> you're working in a single thread (with, e.g. blocking sockets), with no
> real cost. (3) Rapid prototyping in Haskell is actually very easy and
> effective.
> [1]: https://github.com/chrisdone/hulk
> [2]:
>
>
> class Monad m => MonadProvider m where
>
>
>
>   providePreface   :: m (Maybe String)
>
>
>
>   provideMotd  :: m (Maybe String)
>
>
>
>   provideKey   :: m String
>
>
>
>   providePasswords :: m String
>
> [3]: I could stick all these in the StateT, but I think Reader and Writer
> are like nice, statically-enforced documentation.
>
>
> newtype IRC m a = IRC {
>
>
>
> runIRC :: ReaderT (UTCTime,Conn) (WriterT [Reply] (StateT Env m)) a
>
>
>
>   }
>
>   deriving (Monad
>
>
>
>    ,Functor
>
>
>
>    ,MonadWriter [Reply]
>
>
>
>    ,MonadState Env
>
>
>
>    ,MonadReader (UTCTime,Conn))
>
> [4]: FWIW, the development section of CREATE-NET, a research centre in
> Italy. We are hiring Haskellers for application dev…
> ___
> 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] Install GTK on Windows

2011-02-25 Thread aditya siram
Maybe it's erroring out because you have C:\gtk\bin and C:\Documents
...\gtk+bundle...\bin in the same path. You shouldn't need both.  I
also don't see any path that mentions the libxml libraries which you
will eventually need.

When I installed GTK on Windows 7 I also followed the blog post you
mention but found that the instructions didn't totally work for me
completely. That is why I documented my experiences on the Wiki.  So
IMHO you do need INCLUDE and PKG_CONFIG_PATH.

That said I wrote those instructions based on *one* install so they
might well be wrong. I know it's confusing having two sets of
conflicting instructions but I suggest you follow one to completion,
and if it doesn't work, back out the conflicting changes and follow
the other.

-deech

On Fri, Feb 25, 2011 at 7:53 AM, Daniel Díaz  wrote:
>
> El Vie, 25 de Febrero de 2011, 2:34 pm, aditya siram escribió:
>> Hi Daniel,
>> What is the value of PATH, PKG_CONFIG_PATH and INCLUDE in the shell
>> from which you are invoking "cabal install ..."?
>> -deech
>>
>
> PATH:
> C:\Archivos de programa\Haskell\bin
> C:\Archivos de programa\Haskell Platform\2010.2.0.0\lib\extralibs\bin
> C:\Archivos de programa\Haskell Platform\2010.2.0.0\bin
> [...]
> C:\WINDOWS\system32
> C:\WINDOWS
> C:\WINDOWS\System32\Wbem
> [...]
> C:\gtk\bin
> C:\Documents and Settings\User\Datos de programa\cabal\bin
> C:\Archivos de programa\Haskell\bin
> C:\ghc\ghc-6.10.1\bin
> C:\Documents and
> Settings\User\Escritorio\GTK\gtk+-bundle_2.16.6-20100912_win32\bin
> C:\Archivos de programa\Haskell Platform\2010.2.0.0\mingw\bin
>
> PKG_CONFIG_PATH and INCLUDE are empty now. Following the Mark Shroyer's
> guide, these variables are not mentioned.
>
> --
> Daniel Díaz
>
>

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


Re: [Haskell-cafe] Install GTK on Windows

2011-02-25 Thread aditya siram
Hi Daniel,
What is the value of PATH, PKG_CONFIG_PATH and INCLUDE in the shell
from which you are invoking "cabal install ..."?
-deech

On Fri, Feb 25, 2011 at 6:40 AM, Daniel Díaz  wrote:
> Hi, cafe,
>
> I know this has been treated many times, but I've tried install GTK so
> hard without any success that I decided to ask for help.
>
> Firstly, I followed the instructions listed in HaskellWiki [1]. No results.
>
> Then, I followed the instruction from the Mark Shroyer blog [2]. No results.
>
> I did some mixing of the two guides, too, but my error was always the same:
>
> Configuring cairo-0.12.0...
> [...]
> setup.exe: Missing dependencies on foreign libraries:
> * Missing C libraries: z, cairo
>
> Configuring glib-0.12.0...
> [...]
> setup.exe: Missing dependencies on foreign libraries:
> * Missing C libraries: gobject-2.0, gthread-2.0, glib-2.0, intl
>
> I've searched for these libraries, and, with --extra-include-dirs=, I've
> included them. But the same error was thrown.
>
> I'm sure I'm doing something wrong or, perhaps, I'm missing something.
>
> Any help is welcomed!
>
> Thanks in advance,
> Daniel Díaz
>
> References:
>
> [1] http://www.haskell.org/haskellwiki/Gtk2Hs
> [2] http://markshroyer.com/2010/10/gtk2hs-on-windows/
>
>
> ___
> 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] ghci command line execution

2011-02-10 Thread aditya siram
Possibly HSH[1]?
[1] http://hackage.haskell.org/package/HSH-2.0.3

On Thu, Feb 10, 2011 at 8:44 AM, Thomas Davie  wrote:
> A while ago I remember someone showing me some tool, I *think* ghci that 
> allowed you to pass it a function of type String -> String as an input, and 
> have it simply run that function on stdin (presumably using interact) to 
> achieve useful things like this...
>
> $ cat myFile.txt | ghci -e 'unlines . zipWith (\x y -> show x ++ " " ++ y) 
> [1..] . lines'
>
> Does anyone know what it was that I saw being used here?
>
> Thanks
>
> Tom Davie
> ___
> 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] Concurrency best practices?

2011-02-05 Thread aditya siram
There's the stm-io-hooks [1] package but it looks like it hasn't been
updated in a while.
-deech
[1]http://hackage.haskell.org/package/stm-io-hooks

On Sat, Feb 5, 2011 at 3:46 AM, wren ng thornton  wrote:
> So I'm working on a project that uses STM to run a lot of things in parallel
> without the headaches of locks. So far it's working beautifully, STM rocks.
> But there's one snag...
>
> Sometimes I need those threads to do some IO like printing logging info. I'd
> like to make these IO chunks atomic with respect to one another so that the
> logging output isn't garbage. Since I'm using STM everywhere else, I'd love
> to use it for this too (instead of mixing STM and non-STM concurrency)
> except you can't embed IO in STM.
>
> I could just use STM vars as locks to force the atomicity, but locks are
> ugly and bug-prone. So what's the current best practice for doing this kind
> of thing?
>
> --
> Live well,
> ~wren
>
> ___
> 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] Haddock : Synopsis box too big for monitor.

2011-01-29 Thread aditya siram
Hi all,
The new Synopsis box in the API docs expands beyond the monitor for
functions that have long signatures. An example is the TreeView
documentation  [1] in the gtk package.

I have only tested Firefox.

-deech

[1] 
http://hackage.haskell.org/packages/archive/gtk/0.12.0/doc/html/Graphics-UI-Gtk-ModelView-TreeView.html

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


Re: [Haskell-cafe] Haskell for children? Any experience?

2011-01-27 Thread aditya siram
Hi Chris,
I was a little negative in my last message so maybe I can contribute
something positive. If you're looking for a musical way to teach
Haskell I did a Haskell music hackathon [1]  about a year and a half
ago. The idea was to use Haskell [2] to play music through a
Supercollider music server [3] .

Supercollider itself just generates sound so I had to code up support
for scales, arpeggios and chords including the ability to generate
arpeggios and chords from some user-defined scale.

One of the fun applications of this support was to grab 2 yrs worth of
DOW closing numbers from Yahoo Financial and set it to music. The user
was able to select a scale, key, octave and instrument and the code
would autogenerate notes within that scale and with a chordal
accompaniment. It was right around the time of the American
presidential election and the economy being such a big issue, it was
fun listening to the music start off high but get lower and lower over
time.

You are welcome to play around with it and if you run into any
difficulties, let me know.

-deech

[1]  
https://patch-tag.com/r/deech2k/SuperCollider-Haskell/snapshot/current/content/pretty/HaskoreHackfest.hs
[2] http://hackage.haskell.org/package/haskore-supercollider
[3] http://supercollider.sourceforge.net//

On Thu, Jan 27, 2011 at 11:06 AM, Chris Smith  wrote:
> On Thu, 2011-01-27 at 15:26 +, Stephen Tetley wrote:
>> John Peterson had some nice work using Haskore and Fran for elementary
>> teaching on the old Haskell.org website. Google's cache says the old
>> URL was here but its now vanished:
>>
>> www.haskell.org/edsl/campy/campy-2003-music.ppt
>
> That sounds great!  If you do have an existing copy of the slides, I'd
> like to see them.  Especially the idea of using music for programming
> with a nice embedded DSL / combinator library would be amazing.
>
> --
> Chris
>
>
> ___
> 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] Haskell for children? Any experience?

2011-01-27 Thread aditya siram
Ye gods! A B & D [1] language for kids? At least give them a fighting
chance [2] at becoming future developers.

Haskell's immutability is good for mathematics but doing anything else
takes a great deal of up-front patience and perseverance, two very
rare qualities in that demographic if my own childhood is any
indication.

BTW I want to be wrong so if you do succeed with this I will feast on
crow with gusto.

-deech

[1] http://c2.com/cgi/wiki?BondageAndDisciplineLanguage
[2] http://scratch.mit.edu/

On Thu, Jan 27, 2011 at 9:04 AM, Chris Smith  wrote:
> So I find myself being asked to plan Haskell programming classes for one
> hour, once a week, from September through May this coming school year.
> The students will be ages 11 to 13.  I'm wondering if anyone has
> experience in anything similar that they might share with me.  I'm
> trying to decide if this is feasible, or it I should try to do something
> different.
>
> To be honest, as much as I love Haskell, I tried to push the idea of
> learning a different language; perhaps Python.  So far, the kids will
> have none of it!  This year, I've been teaching a once-a-week
> exploratory mathematics sort of thing, and we've made heavy use of
> GHCi... and they now insist on learning Haskell.
>
> (By the way, GHCi is truly amazing for exploratory mathematics.  We
> really ought to promote the idea of Haskell for elementary / junior-high
> level math teachers!  It's so easy to just try stuff; and there are so
> many patterns you can just discover and then say "Huh, why do you think
> that happens?  Can you write it down precisely? ...")
>
> --
> Chris Smith
>
>
> ___
> 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] Conditionals and case expressions in do blocks

2011-01-26 Thread aditya siram
Yep, I do this often and it's pretty nasty. It's especially
inconvenient that you don't have access to computations before the if,
for example:
do
 x <- something
 y <- something-else
 case y of
Foo a -> do
   <--- I want access to 'x' here
Bar b -> ...

-deech

On Wed, Jan 26, 2011 at 2:51 PM, Edward Amsden  wrote:
> Those functions are useful if I'm more interested in actions (for
> instance putStrLn) in IO, but they restrict the monad's return type to
> ().
>
> I'm often writing code like the following:
>
> do
> ...
> case ... of
> Foo x -> do ...
>                  ...
>                  return foobar
> Bar x -> do ...
>                 ...
>                 return foobar
>
> or worse:
>
> if cond
>  then throwError "BBQ!"
>  else do
>         ...
>         ...
>         return ...
>
> (which works btw because throwError is polymorphic in the return type)
>
> So I end up with a nasty set of nested do statements for case expressions.
>
>
> On Wed, Jan 26, 2011 at 3:32 PM, aditya siram  wrote:
>> I think that for monads the cleanest way of doing conditional
>> execution is using  'when' and 'unless' [1] and 'guard' if your type
>> is a Monoid.
>>
>> -deech
>>
>> [1] 
>> http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Monad.html#6
>>
>> On Wed, Jan 26, 2011 at 2:22 PM, Edward Amsden  wrote:
>>> Inside a do block, I can very conveniently substitute
>>>
>>> let x = 
>>> 
>>>
>>> for either
>>> x <- return 
>>> 
>>>
>>> or
>>> let x = 
>>> in do
>>> 
>>>
>>> However, I can't do anything similar (that I know of) with if or case
>>> expressions. If I use if or case inside a do block, it's likely that
>>> I'm still using monadic expressions (at least in my experience). Is
>>> there some nasty semantic ambiguity that comes of this? Is it just not
>>> in the standard yet? Is there some extension that I'm not aware of?
>>>
>>> --
>>> Edward Amsden
>>> Undergraduate
>>> Computer Science
>>> Rochester Institute of Technology
>>> www.edwardamsden.com
>>>
>>> ___
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe@haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>
>
>
>
> --
> Edward Amsden
> Undergraduate
> Computer Science
> Rochester Institute of Technology
> www.edwardamsden.com
>

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


Re: [Haskell-cafe] Conditionals and case expressions in do blocks

2011-01-26 Thread aditya siram
I think that for monads the cleanest way of doing conditional
execution is using  'when' and 'unless' [1] and 'guard' if your type
is a Monoid.

-deech

[1] 
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Monad.html#6

On Wed, Jan 26, 2011 at 2:22 PM, Edward Amsden  wrote:
> Inside a do block, I can very conveniently substitute
>
> let x = 
> 
>
> for either
> x <- return 
> 
>
> or
> let x = 
> in do
> 
>
> However, I can't do anything similar (that I know of) with if or case
> expressions. If I use if or case inside a do block, it's likely that
> I'm still using monadic expressions (at least in my experience). Is
> there some nasty semantic ambiguity that comes of this? Is it just not
> in the standard yet? Is there some extension that I'm not aware of?
>
> --
> Edward Amsden
> Undergraduate
> Computer Science
> Rochester Institute of Technology
> www.edwardamsden.com
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

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


Re: [Haskell-cafe] HMatrix Vector/Matrix interpolation ala Matlab interp/interp2 ??

2011-01-25 Thread aditya siram
Hi,
I've taken a look at your code and refactored a bit to use Haskell's
list functions.  The functionality should be identical.

One of the advantages of using the list functions is that you don't
have to worry about an out-of-bounds exception - which is what your
limIndex function corrects for. Also instead of grabbing list indices
I've created a data structure for points.

I'll just present the code and let you ask me any questions.
-deech

  import Data.List

  -- Input Data
  xi :: [Double]
  xi = [0 .. 10]
  yi :: [Double]
  yi = [2, 3, 5, 6, 7, 8, 9, 10 , 9, 8, 7]
  x = 11 :: Double

  type Point = ((Double,Double),(Double,Double))

  getPnts :: Double -> [Point] -> Point
  getPnts x [] = error "empty list"
  getPnts x xs = case (break (\((i,_),_) -> i > x) xs) of
  (_,[]) -> last xs
  (_,xs) -> head xs

  byTwos :: [a] -> [(a,a)]
  byTwos []= []
  byTwos (x:[])= []
  byTwos (x:y:xs)  = (x,y) : byTwos (y:xs)

  interp :: [Double] -> [Double] -> Double -> Double
  interp xi yi x = let ((x1,x2),(y1,y2)) = getPnts x $ zip (byTwos xi)
(byTwos yi)
   in
   (y2-y1)/(x2-x1) * (x-x1) + x2

  main = print $ interp xi yi 11


On Tue, Jan 25, 2011 at 3:05 PM, gutti  wrote:
>
>
> Hi,
>
> I created some code from scratch - probably "ugly" beginners style - so I'm
> keen to get
> tips how to make it more pretty and faster
>
> Cheers Phil
>
> import Data.List
>
> -- Input Data
> xi :: [Double]
> xi = [0 .. 10]
> yi :: [Double]
> yi = [2, 3, 5, 6, 7, 8, 9, 10 , 9, 8, 7]
> x = 11 :: Double
>
> -- Functions
> limIndex xi idx
>    | idx < 0 = 0
>    | idx > (length xi)-2 = (length xi)-2
>    | otherwise = idx
>
> getIndex xi x = limIndex xi (maybe (length xi) id (findIndex (>x) xi)-1)
>
> getPnts xi yi idx = [xi !! idx, xi !! (idx+1), yi !! idx, yi !! (idx+1)]
>
> interp xi yi x =
>        let pts = getPnts xi yi (getIndex xi x)
>        in (pts!!3-pts!!2)/(pts!!1-pts!!0)*(x-pts!!0)+pts!!2
>
> -- Calc
> y = interp xi yi x
>
> main = do
>        -- Output Data
>        print (y)
>
>
>
>
> --
> View this message in context: 
> http://haskell.1045720.n5.nabble.com/HMatrix-Vector-Matrix-interpolation-ala-Matlab-interp-interp2-tp3352833p3356966.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.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] Guy Steele's Praise For Haskell @ Strange Loop Keynote

2011-01-15 Thread aditya siram
Guy Steele did the keynote on parallelism [1] at the Strange Loop [2]
conference in which he said that he could do it over Fortress [3]
would have been modeled on Haskell rather than Fortran. The relevant
portions are between 49:36 - 49:50. Thought it might interest readers
of this list.

-deech

[1] http://www.infoq.com/presentations/Thinking-Parallel-Programming
[2] http://strangeloop2010.com/
[3] http://en.wikipedia.org/wiki/Fortress_(programming_language)

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


Re: [Haskell-cafe] Join Manatee Team!

2011-01-10 Thread aditya siram
I do have some errors in ghc-pkg but they don't seem to relate to
manatee. I am using ghc-6.12.3

>  ghc-pkg check
There are problems in package happstack-util-0.5.0.2:
  dependency "strict-concurrency-0.2.3-27185142ee20a352ac984eb1a7ba31ea"
doesn't exist
There are problems in package hlint-1.8.3:
  dependency "uniplate-1.5.1-43c5344609d31cc668c4c59beef1c515" doesn't exist
There are problems in package yi-0.6.2.2:
  dependency "derive-2.3.0.2-c8dea0face9fceb5dab2c976a7cef69b" doesn't exist
  dependency "regex-tdfa-1.1.6-49fe08d7468d9de43cefb17ac16ff6bf" doesn't exist
  dependency "uniplate-1.5.1-43c5344609d31cc668c4c59beef1c515" doesn't exist
There are problems in package filestore-0.3.4.1:
  dependency "datetime-0.2-bcd61567f8553949b0cce107933fa526" doesn't exist
There are problems in package gitit-0.7.3.6:
  dependency "datetime-0.2-bcd61567f8553949b0cce107933fa526" doesn't exist

The following packages are broken, either because they have a problem
listed above, or because they depend on a broken package.
happstack-util-0.5.0.2
hlint-1.8.3
yi-0.6.2.2
filestore-0.3.4.1
gitit-0.7.3.6
happstack-0.5.0.3
happstack-server-0.5.0.2
happstack-ixset-0.5.0.3
happstack-data-0.5.0.2
happstack-state-0.5.0.4

> ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.3

-deech

On Mon, Jan 10, 2011 at 8:40 PM, Andy Stewart  wrote:
> Hi aditya,
>
> What's the result of command "ghc-pkg check"?
> And which GHC version do you use?
>
> Manatee can't work with ghc-7.0.1 (ghc-7.0.1 have bug)
>
> Thanks,
>
>  -- Andy
>
> aditya siram  writes:
>
>> Thanks for the great software! I tried to install manatee from Hackage
>> and got the following error:
>> Configuring manatee-core-0.0.7...
>> Warning: This package indirectly depends on multiple versions of the same
>> package. This is highly likely to cause a compile failure.
>> package uniplate-1.5.1 requires containers-0.3.0.0
>> package template-haskell-2.4.0.1 requires containers-0.3.0.0
>> package regex-tdfa-1.1.6 requires containers-0.3.0.0
>> package regex-base-0.93.2 requires containers-0.3.0.0
>> package pango-0.12.0 requires containers-0.3.0.0
>> package manatee-core-0.0.7 requires containers-0.3.0.0
>> package hpc-0.5.0.5 requires containers-0.3.0.0
>> package gtksourceview2-0.12.2 requires containers-0.3.0.0
>> package gtk-serialized-event-0.12.0 requires containers-0.3.0.0
>> package gtk-0.12.0 requires containers-0.3.0.0
>> package glib-0.12.0 requires containers-0.3.0.0
>> package gio-0.12.0 requires containers-0.3.0.0
>> package ghc-binary-0.5.0.2 requires containers-0.3.0.0
>> package ghc-6.12.3 requires containers-0.3.0.0
>> package gconf-0.12.0 requires containers-0.3.0.0
>> package derive-2.4.1 requires containers-0.3.0.0
>> package deepseq-1.1.0.2 requires containers-0.3.0.0
>> package dbus-core-0.8.5.3 requires containers-0.3.0.0
>> package dbus-client-0.3 requires containers-0.3.0.0
>> package dataenc-0.13.0.4 requires containers-0.3.0.0
>> package binary-0.5.0.2 requires containers-0.3.0.0
>> package Cabal-1.8.0.6 requires containers-0.3.0.0
>> package template-haskell-2.4.0.1 requires containers-0.4.0.0
>> package regex-base-0.93.2 requires mtl-1.1.0.2
>> package uniplate-1.5.1 requires mtl-2.0.1.0
>> package regex-tdfa-1.1.6 requires mtl-2.0.1.0
>> package pango-0.12.0 requires mtl-2.0.1.0
>> package manatee-core-0.0.7 requires mtl-2.0.1.0
>> package gtksourceview2-0.12.2 requires mtl-2.0.1.0
>> package gtk-serialized-event-0.12.0 requires mtl-2.0.1.0
>> package gtk-0.12.0 requires mtl-2.0.1.0
>> package gio-0.12.0 requires mtl-2.0.1.0
>> package gconf-0.12.0 requires mtl-2.0.1.0
>> package cairo-0.12.0 requires mtl-2.0.1.0
>> package QuickCheck-2.1.1.1 requires mtl-2.0.1.0
>> package ghc-6.12.3 requires template-haskell-2.4.0.1
>> package manatee-core-0.0.7 requires template-haskell-2.4.0.1
>> package derive-2.4.1 requires template-haskell-2.4.0.1
>> Preprocessing library manatee-core-0.0.7...
>> Building manatee-core-0.0.7...
>> : cannot satisfy -package-id
>> derive-2.4.1-4ef8b6126acc8c74f66079e125ebc9fd:
>>     derive-2.4.1-4ef8b6126acc8c74f66079e125ebc9fd is unusable due to
>> missing or recursive dependencies:
>>       template-haskell-2.4.0.1-e67380b2b1931beefbe73530e50ff045
>>     (use -v for more information)
>> cabal: Error: some packages failed to install:
>> manatee-0.1.7 depends on manatee-core-0.0.7 which failed to install.
>> manatee-core-0.0.7 failed during the building phase. The exception was:
>> exit: ExitFailure 1

Re: [Haskell-cafe] Join Manatee Team!

2011-01-10 Thread aditya siram
Thanks for the great software! I tried to install manatee from Hackage
and got the following error:
Configuring manatee-core-0.0.7...
Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.
package uniplate-1.5.1 requires containers-0.3.0.0
package template-haskell-2.4.0.1 requires containers-0.3.0.0
package regex-tdfa-1.1.6 requires containers-0.3.0.0
package regex-base-0.93.2 requires containers-0.3.0.0
package pango-0.12.0 requires containers-0.3.0.0
package manatee-core-0.0.7 requires containers-0.3.0.0
package hpc-0.5.0.5 requires containers-0.3.0.0
package gtksourceview2-0.12.2 requires containers-0.3.0.0
package gtk-serialized-event-0.12.0 requires containers-0.3.0.0
package gtk-0.12.0 requires containers-0.3.0.0
package glib-0.12.0 requires containers-0.3.0.0
package gio-0.12.0 requires containers-0.3.0.0
package ghc-binary-0.5.0.2 requires containers-0.3.0.0
package ghc-6.12.3 requires containers-0.3.0.0
package gconf-0.12.0 requires containers-0.3.0.0
package derive-2.4.1 requires containers-0.3.0.0
package deepseq-1.1.0.2 requires containers-0.3.0.0
package dbus-core-0.8.5.3 requires containers-0.3.0.0
package dbus-client-0.3 requires containers-0.3.0.0
package dataenc-0.13.0.4 requires containers-0.3.0.0
package binary-0.5.0.2 requires containers-0.3.0.0
package Cabal-1.8.0.6 requires containers-0.3.0.0
package template-haskell-2.4.0.1 requires containers-0.4.0.0
package regex-base-0.93.2 requires mtl-1.1.0.2
package uniplate-1.5.1 requires mtl-2.0.1.0
package regex-tdfa-1.1.6 requires mtl-2.0.1.0
package pango-0.12.0 requires mtl-2.0.1.0
package manatee-core-0.0.7 requires mtl-2.0.1.0
package gtksourceview2-0.12.2 requires mtl-2.0.1.0
package gtk-serialized-event-0.12.0 requires mtl-2.0.1.0
package gtk-0.12.0 requires mtl-2.0.1.0
package gio-0.12.0 requires mtl-2.0.1.0
package gconf-0.12.0 requires mtl-2.0.1.0
package cairo-0.12.0 requires mtl-2.0.1.0
package QuickCheck-2.1.1.1 requires mtl-2.0.1.0
package ghc-6.12.3 requires template-haskell-2.4.0.1
package manatee-core-0.0.7 requires template-haskell-2.4.0.1
package derive-2.4.1 requires template-haskell-2.4.0.1
Preprocessing library manatee-core-0.0.7...
Building manatee-core-0.0.7...
: cannot satisfy -package-id
derive-2.4.1-4ef8b6126acc8c74f66079e125ebc9fd:
derive-2.4.1-4ef8b6126acc8c74f66079e125ebc9fd is unusable due to
missing or recursive dependencies:
  template-haskell-2.4.0.1-e67380b2b1931beefbe73530e50ff045
(use -v for more information)
cabal: Error: some packages failed to install:
manatee-0.1.7 depends on manatee-core-0.0.7 which failed to install.
manatee-core-0.0.7 failed during the building phase. The exception was:
exit: ExitFailure 1

-deech

On Mon, Jan 10, 2011 at 7:45 PM, Andy Stewart  wrote:
> Hi all,
>
> I'm Andy, the author of Manatee
> ( http://haskell.org/haskellwiki/Manatee ).
>
> You can watch video
>  http://www.youtube.com/watch?v=weS6zys3U8k
>  (or http://www.youtube.com/watch?v=A3DgKDVkyeM )
> to understand "What is it?" . :)
>
> Manatee is Haskell integrated environment written in Haskell.
>
> The goal of the Manatee project is provide a fast, safe and flexible
> integrated environment for haskell hacking.
>
> Some cool feature in Manatee:
>
>    * It can dynamic update Haskell extension code in runtime, like elisp
>      for Emacs.
>
>    * It protected every application in sandbox, so it minimum your
>      losses once unexpected exception throw.
>
>    * It's multi-thread design, it's won't freeze your operation in anytime.
>
>    * It provide handy window manage, you can mix any application
>      together fastly.
>
>    * You can use keyboard control everything you want, and same
>      experience in all applications. :)
>
>    * You can use it develop any application you want, not just text
>      toy. :)
>
>    ... etc.
>
> I'm looking for new developer join Manatee Team, I believe you guys can
> develop cooler application than me. :)
>
> If you interested Manatee, welcome to join
>
>   manatee-u...@googlegroups.com
>   (or https://groups.google.com/forum/#!forum/manatee-user )
>
> Thanks,
>
>  -- Andy
>
> PS. I'm working on session manager and IDE feature...
>
>
> ___
> 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] getting last char of String

2010-12-31 Thread aditya siram
-- untested and won't work on an infinite list
last :: [a] -> a
last = head . reverse

-deech

On Fri, Dec 31, 2010 at 2:39 PM, Aaron Gray  wrote:
> Is there an easy Haskell function that gets the last Char of a [Char] or
> String ?
> Many thanks in advance,
> Aaron
>
> ___
> 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] "record" types and unique names

2010-12-30 Thread aditya siram
Take a look at the record field disambiguation [1] extension to GHC.
It sounds like what you're looking for.
-deech
[1] 
http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/syntax-extns.html#disambiguate-fields

On Thu, Dec 30, 2010 at 11:01 AM, Aaron Gray  wrote:
> Given a Haskell "record type" :-
>     data Test
>         = Test {
>             name :: String,
>             value :: Int
>         }
>     test = Test {
>             name = "test",
>     value = 1
>         }
>     main :: IO ()
>     main = do
>         putStrLn (name test)
> Are "name" and "value" in the global name space, as the following gives an
> error "Multiple declarations of `name'" :-
>     name :: String -> String
>     name s = s
> Is there any way round this ?
> Many thanks in advance,
> Aaron
>
> ___
> 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] "record" types and unique names

2010-12-30 Thread aditya siram
I don't think record field disambiguation what you're after. My apologies.
-deech

On Thu, Dec 30, 2010 at 11:20 AM, aditya siram  wrote:
> Take a look at the record field disambiguation [1] extension to GHC.
> It sounds like what you're looking for.
> -deech
> [1] 
> http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/syntax-extns.html#disambiguate-fields
>
> On Thu, Dec 30, 2010 at 11:01 AM, Aaron Gray  
> wrote:
>> Given a Haskell "record type" :-
>>     data Test
>>         = Test {
>>             name :: String,
>>             value :: Int
>>         }
>>     test = Test {
>>             name = "test",
>>     value = 1
>>         }
>>     main :: IO ()
>>     main = do
>>         putStrLn (name test)
>> Are "name" and "value" in the global name space, as the following gives an
>> error "Multiple declarations of `name'" :-
>>     name :: String -> String
>>     name s = s
>> Is there any way round this ?
>> Many thanks in advance,
>> Aaron
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>

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


Re: [Haskell-cafe] What are these comments for {-# SCC "Mangler" #-}

2010-12-29 Thread aditya siram
Check out the "Time Profiling" of the Chapter 25 of Real World Haskell
[1] for a detailed explanation.
-deech

[1] http://book.realworldhaskell.org/read/profiling-and-optimization.html

On Wed, Dec 29, 2010 at 6:48 PM, Aaron Gray  wrote:
> What are these comments for in Happy ?
>     {-# SCC "Mangler" #-}
> Many thanks in advance,
> Aaron
>
> ___
> 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] multi type addition

2010-12-28 Thread aditya siram
The problem here is that unfortunately the Haskell type system cannot
do coercion.

There is however a toRational method "Real" typeclass that converts
instances of Num and Ord to Rational data type and a fromRational
method that converts back. So your code could be:

myplus :: (Real a, Real b) => a -> b -> Float
a `myplus` b = fromRational(toRational a + toRational b)

> (1 :: Integer) `myplus` (2::Integer)
3.0
> (1.5 :: Float) `myplus` (2::Integer)
3.5

-deech

[1] 
http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.html#t:Real
[2] 
http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.html#t:Rational

On Tue, Dec 28, 2010 at 3:45 PM, william murphy  wrote:
> We were trying to make an addition function that, unlike the library one,
> could add numbers of different types from the typeclass 'Num.' We originally
> ran into a problem when trying to add (5 :: Integer) + 4.8, and were trying
> to define a new function that would be able to get that:
>
> (+') :: (Num a, Num b) => a -> b -> Float
> x +' b = d + e
>  where d :: Float
>    d = x
>    e :: Float
>    e = b
>
>
> This gave us the error:
>
>     Couldn't match expected type `Float' against inferred type `b'
>   `b' is a rigid type variable bound by
>   the type signature for `pl' at test.hs:9:18
>     In the expression: b
>     In the definition of `e': e = b
>     In the definition of `pl':
>     pl x b
>  = d + e
>  where
>  d :: Float
>  d = x
>  e :: Float
>  e = b
> Failed, modules loaded: none.
>
>
> ___
> 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] Polymorphic function over pairs of maybes.

2010-12-28 Thread aditya siram
Although I don't understand it myself Oleg's deepest functor [1] seems
to be what you're looking for.
-deech

[1] http://okmij.org/ftp/Haskell/deepest-functor.lhs

On Tue, Dec 28, 2010 at 1:23 PM, Edward Amsden  wrote:
> Hello all:
>
> I'd like to right a function that could take a structure with type
> (random example):
>
> (Int, (String, (Int, Int)))
>
> and another where each individual value is a Maybe of the
> corresponding type, for example:
> (Maybe Int, (Maybe String, (Maybe Int, Maybe Int)))
>
> and perform a fromMaybe using the values to produce a new value with
> the original types. The catch is, I'd like to be able to do that for
> an n-deep structure with any type, without having to write a separate
> function for them. I'm not even sure that this is possible, but
> perhaps someone could explain how it is or isn't?
>
>
> --
> Edward Amsden
> Undergraduate
> Computer Science
> Rochester Institute of Technology
> www.edwardamsden.com
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

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


Re: [Haskell-cafe] global, modifiable variable for debugging

2010-12-26 Thread aditya siram
If you don't want go the unsafePerformIO route you might use implicit
parameters [1]. You can add an hidden parameter to a function like:
{-# LANGUAGE ImplicitParams #-}

func1 :: (?dbg :: Bool) => String -> String
func1 s = if ?dbg then (func2 ("func1 : " ++ s))
  else s

func2 :: (?dbg :: Bool) => String -> String
func2 s = if ?dbg then (let ?dbg = not ?dbg in func3 ("func2 : " ++ s))
  else s

func3 :: (?dbg :: Bool) => String -> String
func3 s =  if ?dbg then ("func3 : " ++ s)
   else s

test bool = do
  let ?dbg = bool
  putStrLn $ func1 "hello world"
  putStrLn $ func3 "goodbye world"

> test True
func2 : func1 : hello world
func3 : goodbye world

> test False
hello world
goodbye world

Notice that the value of ?dbg is propagated even though it is never
explicitly passed into func1. Similarly func1 never explicitly passes
?dbg to func2.  Also as in func2 you can change ?dbg for other
functions downstream, but not the original ?dbg as shown by the second
"putStrLn ... ".

It seems a more flexible approach to a global variable but it does
litter your function signatures with "(?dbg :: Bool)".

-deech

[1] 
http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/other-type-extensions.html#implicit-parameters

On Sun, Dec 26, 2010 at 1:53 PM,   wrote:
> Hi,
>
> I have a program with a debug flag in it (Strangely I've yet to be
> able to write bug-free code).  I'd like to change the state of the
> debug flag based on command line args.
>
> I looked at IOVar but that would cause all the pure procedures to get
> swallowed by the IO Monad.
>
> Is a better way to get this behavior ?
>
> Thanks,
>
> Brian
>
>
> ___
> 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] Proof in Haskell

2010-12-21 Thread aditya siram
I don't know the formal definition, but dependent types seem analogous
to checking an invariant at runtime.
-deech

On Tue, Dec 21, 2010 at 5:53 AM, Patrick Browne  wrote:
> Hi,
> In a previous posting[1] I asked was there a way to achieve a proof of
> mirror (mirror x) = x
>
> in Haskell itself. The code for the tree/mirror is below:
>
>  module BTree where
>  data Tree a = Tip | Node (Tree a) a (Tree a)
>
>  mirror ::  Tree a -> Tree a
>  mirror (Node x y z) = Node (mirror z) y (mirror x)
>  mirror Tip = Tip
>
> The reply from Eugene Kirpichov was:
>>> It is not possible at the value level, because Haskell does not
>>> support dependent types and thus cannot express the type of the
>>> proposition
>>> "forall a . forall x:Tree a, mirror (mirror x) = x",
>>> and therefore a proof term also cannot be constructed.
>
> Could anyone explain what *dependent types* mean in this context?
> What is the exact meaning of forall a and forall x?
>
> Thanks,
> Pat
> [1] http://www.mail-archive.com/haskell-cafe@haskell.org/msg64842.html
>
>
>
>
>
>
>
>
> This message has been scanned for content and viruses by the DIT Information 
> Services E-Mail Scanning Service, and is believed to be clean. 
> http://www.dit.ie
>
> ___
> 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] Making type-incompatible strategies interchangeable

2010-12-18 Thread aditya siram
Warning! Incredibly hacky Haskell coming up!

Here's some code that seems to do the near same thing as your Python.
Below it is some sample output. A couple of differences are that the
secret number should be between 1 and 10, and whenever the computer
tries guess it just picks a random number until it get it right.
Additionally the code maintains a record of wrong guesses in a list as
opposed to an incrementing count.

-deech

{-# LANGUAGE ScopedTypeVariables, EmptyDataDecls, PackageImports #-}
import Control.Monad.Random
import "mtl" Control.Monad.State
import "mtl" Control.Monad.Writer

human_asker :: IO Int
human_asker = do
  putStrLn "What's the secret number?"
  getLine >>= return . read

randomNum :: Int -> Int -> IO Int
randomNum low high = getStdRandom $ randomR (low, high)

computer_asker :: IO Int
computer_asker = randomNum 1 10

computer_guesser :: StateT Int (WriterT [Int] IO) ()
computer_guesser = do
  guess::Int <- liftIO $ randomNum 1 10
  secret <- get
  process guess secret
where
  process g s
   | g < s = do {tell [g]; liftIO $ putStrLn "Too low";
computer_guesser}
   | g > s = do {tell [g]; liftIO $ putStrLn "Too high";
computer_guesser}
   | g == s = do {liftIO $ putStrLn "Got it!"}

human_guesser :: StateT Int (WriterT [Int] IO) ()
human_guesser = do
  guess::Int <- liftIO $ do {putStrLn "What's your guess?";
 getLine >>= return . read;}
  secret <- get
  process guess secret
  where
process g s
   | g < s = do {tell [g]; liftIO $ putStrLn "Too low"; human_guesser}
   | g > s = do {tell [g]; liftIO $ putStrLn "Too high"; human_guesser}
   | g == s = do {liftIO $ putStrLn "Got it!"}

play asker guesser = asker >>= runWriterT . execStateT guesser

-- # Output From Sample Runs
> play human_asker computer_guesser
What's the secret number?
10
Too low
Too low
Too low
Too low
Too low
Too low
Too low
Too low
Too low
Too low
Too low
Too low
Too low
Too low
Too low
Too low
Got it!
(10,[3,8,7,7,1,5,8,6,4,7,1,8,5,7,2,3])

*Main> play computer_asker computer_guesser
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Too high
Got it!
(1,[4,10,2,10,8,10,6,6,3,7,2,6,3,4,9,4,8,6,7])



On Sat, Dec 18, 2010 at 7:31 AM, Heinrich Apfelmus
 wrote:
> Jacek Generowicz wrote:
>>
>> # Imagine an activity which may be performed either by a computer, or
>> # by a human (alternatively, either locally, or remotely across a
>> # network). From Haskell's type system's perspective, these two will
>> # look completely different (most obviously, the human (or the
>> # network) is wrapped in IO). How can they be made interchangeable ?
>>
>> # To demonstrate what I mean, I offer the following concrete toy
>> # example, in Python.
>>
>> # It's a harness for playing the trivial higher-lower number guessing
>> # game, with interchangeable strategies for either player. In this
>> # example I provide two strategies (Computer / ask Human via IO) for
>> # each role (asker and guesser).
>>
>> # How can this sort of interchangeability of computations which are
>> # conceptually identical, but incompatible from the types perspective,
>> # be expressed in Haskell?
>
> Have a look at my  operational  package, in particular the  TicTacToe.hs
>  example on the examples page.
>
>   http://hackage.haskell.org/package/operational
>
> (Unfortunately, the  haskell.org  domain is seized at the moment, so this
> link won't work for a while. Also, please yell if you can't find the
> examples page once the link works again.)
>
>
> Regards,
> Heinrich Apfelmus
>
> --
> http://apfelmus.nfshost.com
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

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


Re: [Haskell-cafe] Why is Haskell flagging this?

2010-12-18 Thread aditya siram
To make that a little clearer, here is code that uses two calls to fmap to
drill through two monadic layers:
f :: [Int] -> IO [Int]
f lst = do return lst

main = do let lst = f [1,2,3,4,5]
  fmap (fmap (+1)) lst

So the order of operations is :
1. The first fmap converts an IO [Int] to [Int] and hands it off to the
second fmap
2. The second fmap applies the (+1) function to every element of the list.
3. The second fmap re-wraps the elements back into a [Int]
4. The first fmap re-wraps and returns the transformed [Int] into an IO
[Int].

-deech


On Fri, Dec 17, 2010 at 3:27 PM, aditya siram wrote:

> I think it is giving you the error because you the "fmap" in your code is
> operating on the IO monad and not the List monad. In order to get it to
> work, you can remove the IO layer with ">>=" as below:
>
>
> f :: [Int] -> IO [Int]
> f lst = do return lst
>
> main = do let lst = f [1,2,3,4,5]
>   lst >>= return . fmap (+1)
>
> Or you can not wrap the list in IO to begin with, my guess is that you
> wrote 'f' to make the compiler happy at some point in development:
> main = do let lst = [1,2,3,4,5]
>   return $ fmap (+1) lst
>
> -deech
>
> On Fri, Dec 17, 2010 at 11:04 AM, michael rice  wrote:
>
>> I don't understand this error message. Haskell appears not to understand
>> that 1 is a Num.
>>
>> Prelude> :t 1
>> 1 :: (Num t) => t
>> Prelude> :t [1,2,3,4,5]
>> [1,2,3,4,5] :: (Num t) => [t]
>> Prelude>
>>
>> Michael
>>
>> ===
>>
>> f :: [Int] -> IO [Int]
>> f lst = do return lst
>>
>> main = do let lst = f [1,2,3,4,5]
>>   fmap (+1) lst
>>
>> ===
>>
>> Prelude> :l test
>> [1 of 1] Compiling Main ( test.hs, interpreted )
>>
>> test.hs:5:17:
>> No instance for (Num [Int])
>>   arising from the literal `1' at test.hs:5:17
>> Possible fix: add an instance declaration for (Num [Int])
>> In the second argument of `(+)', namely `1'
>> In the first argument of `fmap', namely `(+ 1)'
>> In the expression: fmap (+ 1) lst
>> Failed, modules loaded: none.
>> Prelude>
>>
>>
>> ___
>> 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] DNS problems at haskell.org?

2010-12-18 Thread aditya siram
It's fixed now. Try www.haskell.org. Check out
http://www.reddit.com/r/haskell/comments/encrv/whats_happened_to_haskellorg_did_someone_forget/
for more discussion.
-deech

On Sat, Dec 18, 2010 at 9:12 AM, John D. Ramsdell  wrote:
> I think someone failed to pay a bill for using the domain name haskell.org.
>
> John
>
> On Fri, Dec 17, 2010 at 12:05 PM, aditya siram  wrote:
>> I have the same problem.
>> -deech
>>
>>
>> On Fri, Dec 17, 2010 at 8:01 AM, Eugene Kirpichov  
>> wrote:
>>> Hello.
>>>
>>> For a couple of friends of mine, hackage.haskell.org happens to
>>> resolve to something strange (parked domain), though haskell.org works
>>> ok. This might be something to tell to haskell.org admins.
>>>
>>> Find below an example tracert (messages in Russian have been translated).
>>>
>>> C:\Program Files (x86)\Far2>tracert hackage.haskell.org
>>>
>>> Tracing to hackage.haskell.org [209.62.105.19], max hops = 30
>>>
>>>  1     8 ms     4 ms     4 ms  bsr01.nn.ertelecom.ru [91.144.184.69]
>>>  2     *        *        2 ms  net184-77.nn.ertelecom.ru [91.144.184.77]
>>>  3    13 ms     9 ms     9 ms
>>> NNOV-D2-HQ-XX---1-3-0.499.main.synterra.ru [83.229.187.17]
>>>  4     9 ms    29 ms     9 ms  83.229.226.101
>>>  5    10 ms     9 ms     9 ms  m9-cr01-te4-3.msk.stream-internet.net
>>> [195.34.38.37]
>>>  6   142 ms   142 ms   142 ms  ss-crs-1-be3.msk.stream-internet.net
>>> [195.34.53.86]
>>>  7   142 ms   142 ms   142 ms  mar-crs-1-be6.msk.stream-internet.net
>>> [195.34.59.141]
>>>  8   143 ms   142 ms   142 ms  oct-crs-1-be1.spb.stream-internet.net
>>> [195.34.53.194]
>>>  9   143 ms   142 ms   142 ms  bro-cr01-be3.stk.stream-internet.net
>>> [212.188.1.194]
>>>  10    66 ms    66 ms    66 ms  tct-cr01-te5-1.ams.stream-internet.net
>>> [195.34.53.14]
>>>  11   142 ms   307 ms   207 ms  sd-cr01-te2-1.nyc.stream-internet.net
>>> [195.34.59.114]
>>>  12     *        *        *     Request timed out
>>>  13   179 ms   179 ms   179 ms  e8-2.ibr03.dllstx3.networklayer.com
>>> [70.87.253.189]
>>>  14   190 ms   189 ms   190 ms  e1-1.ibr01.hstntx2.networklayer.com
>>> [70.87.253.50]
>>>  15   190 ms   190 ms   190 ms  te2-2.dsr02.hstntx2.networklayer.com
>>> [74.55.252.38]
>>>  16   184 ms   185 ms   184 ms  po2.car3.hstntx2.networklayer.com
>>> [74.55.252.106]
>>>  17   189 ms   189 ms   189 ms  ev1s-209-62-105-19.theplanet.com 
>>> [209.62.105.19]
>>>
>>> Trace finished
>>>
>>> C:\Program Files (x86)\Far2>tracert haskell.org
>>>
>>> Tracing to haskell.org [78.46.100.180], max hops = 30
>>>
>>>  1     4 ms     3 ms     2 ms  bsr01.nn.ertelecom.ru [91.144.184.69]
>>>  2     *        2 ms     2 ms  net184-77.nn.ertelecom.ru [91.144.184.77]
>>>  3    10 ms     9 ms     9 ms
>>> NNOV-D2-HQ-XX---1-3-0.499.main.synterra.ru [83.229.187.17]
>>>  4     9 ms     9 ms    11 ms  83.229.226.101
>>>  5    10 ms     9 ms     9 ms  m9-cr01-te4-3.msk.stream-internet.net
>>> [195.34.38.37]
>>>  6    55 ms    55 ms    55 ms  ss-crs-1-be3.msk.stream-internet.net
>>> [195.34.53.86]
>>>  7    53 ms    52 ms    52 ms  m9-crs-1-be9.msk.stream-internet.net
>>> [195.34.59.250]
>>>  8    55 ms    55 ms    55 ms  bor-crs-1-be1.spb.stream-internet.net
>>> [195.34.53.126]
>>>  9    52 ms    52 ms    52 ms  anc-cr01-po3.ff.stream-internet.net
>>> [195.34.53.102]
>>>  10    52 ms    52 ms    52 ms  anc-cr02-po1.ff.stream-internet.net
>>> [212.188.0.122]
>>>  11    56 ms    56 ms    56 ms  decix2-gw.hetzner.de [80.81.193.164]
>>>  12    60 ms    60 ms    60 ms  hos-bb1.juniper1.fs.hetzner.de 
>>> [213.239.240.242]
>>>  13    64 ms    61 ms    63 ms  hos-tr1.ex3k10.rz12.hetzner.de 
>>> [213.239.228.139]
>>>  14    60 ms    60 ms    62 ms  lambda.haskell.org [78.46.100.180]
>>>
>>> Trace finished
>>>
>>>
>>> --
>>> Eugene Kirpichov
>>> Senior Software Engineer,
>>> Grid Dynamics http://www.griddynamics.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


Re: [Haskell-cafe] DNS problems at haskell.org?

2010-12-18 Thread aditya siram
I have the same problem.
-deech


On Fri, Dec 17, 2010 at 8:01 AM, Eugene Kirpichov  wrote:
> Hello.
>
> For a couple of friends of mine, hackage.haskell.org happens to
> resolve to something strange (parked domain), though haskell.org works
> ok. This might be something to tell to haskell.org admins.
>
> Find below an example tracert (messages in Russian have been translated).
>
> C:\Program Files (x86)\Far2>tracert hackage.haskell.org
>
> Tracing to hackage.haskell.org [209.62.105.19], max hops = 30
>
>  1     8 ms     4 ms     4 ms  bsr01.nn.ertelecom.ru [91.144.184.69]
>  2     *        *        2 ms  net184-77.nn.ertelecom.ru [91.144.184.77]
>  3    13 ms     9 ms     9 ms
> NNOV-D2-HQ-XX---1-3-0.499.main.synterra.ru [83.229.187.17]
>  4     9 ms    29 ms     9 ms  83.229.226.101
>  5    10 ms     9 ms     9 ms  m9-cr01-te4-3.msk.stream-internet.net
> [195.34.38.37]
>  6   142 ms   142 ms   142 ms  ss-crs-1-be3.msk.stream-internet.net
> [195.34.53.86]
>  7   142 ms   142 ms   142 ms  mar-crs-1-be6.msk.stream-internet.net
> [195.34.59.141]
>  8   143 ms   142 ms   142 ms  oct-crs-1-be1.spb.stream-internet.net
> [195.34.53.194]
>  9   143 ms   142 ms   142 ms  bro-cr01-be3.stk.stream-internet.net
> [212.188.1.194]
>  10    66 ms    66 ms    66 ms  tct-cr01-te5-1.ams.stream-internet.net
> [195.34.53.14]
>  11   142 ms   307 ms   207 ms  sd-cr01-te2-1.nyc.stream-internet.net
> [195.34.59.114]
>  12     *        *        *     Request timed out
>  13   179 ms   179 ms   179 ms  e8-2.ibr03.dllstx3.networklayer.com
> [70.87.253.189]
>  14   190 ms   189 ms   190 ms  e1-1.ibr01.hstntx2.networklayer.com
> [70.87.253.50]
>  15   190 ms   190 ms   190 ms  te2-2.dsr02.hstntx2.networklayer.com
> [74.55.252.38]
>  16   184 ms   185 ms   184 ms  po2.car3.hstntx2.networklayer.com
> [74.55.252.106]
>  17   189 ms   189 ms   189 ms  ev1s-209-62-105-19.theplanet.com 
> [209.62.105.19]
>
> Trace finished
>
> C:\Program Files (x86)\Far2>tracert haskell.org
>
> Tracing to haskell.org [78.46.100.180], max hops = 30
>
>  1     4 ms     3 ms     2 ms  bsr01.nn.ertelecom.ru [91.144.184.69]
>  2     *        2 ms     2 ms  net184-77.nn.ertelecom.ru [91.144.184.77]
>  3    10 ms     9 ms     9 ms
> NNOV-D2-HQ-XX---1-3-0.499.main.synterra.ru [83.229.187.17]
>  4     9 ms     9 ms    11 ms  83.229.226.101
>  5    10 ms     9 ms     9 ms  m9-cr01-te4-3.msk.stream-internet.net
> [195.34.38.37]
>  6    55 ms    55 ms    55 ms  ss-crs-1-be3.msk.stream-internet.net
> [195.34.53.86]
>  7    53 ms    52 ms    52 ms  m9-crs-1-be9.msk.stream-internet.net
> [195.34.59.250]
>  8    55 ms    55 ms    55 ms  bor-crs-1-be1.spb.stream-internet.net
> [195.34.53.126]
>  9    52 ms    52 ms    52 ms  anc-cr01-po3.ff.stream-internet.net
> [195.34.53.102]
>  10    52 ms    52 ms    52 ms  anc-cr02-po1.ff.stream-internet.net
> [212.188.0.122]
>  11    56 ms    56 ms    56 ms  decix2-gw.hetzner.de [80.81.193.164]
>  12    60 ms    60 ms    60 ms  hos-bb1.juniper1.fs.hetzner.de 
> [213.239.240.242]
>  13    64 ms    61 ms    63 ms  hos-tr1.ex3k10.rz12.hetzner.de 
> [213.239.228.139]
>  14    60 ms    60 ms    62 ms  lambda.haskell.org [78.46.100.180]
>
> Trace finished
>
>
> --
> Eugene Kirpichov
> Senior Software Engineer,
> Grid Dynamics http://www.griddynamics.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] Why is Haskell flagging this?

2010-12-18 Thread aditya siram
I think it is giving you the error because you the "fmap" in your code is
operating on the IO monad and not the List monad. In order to get it to
work, you can remove the IO layer with ">>=" as below:

f :: [Int] -> IO [Int]
f lst = do return lst

main = do let lst = f [1,2,3,4,5]
  lst >>= return . fmap (+1)

Or you can not wrap the list in IO to begin with, my guess is that you wrote
'f' to make the compiler happy at some point in development:
main = do let lst = [1,2,3,4,5]
  return $ fmap (+1) lst

-deech

On Fri, Dec 17, 2010 at 11:04 AM, michael rice  wrote:

> I don't understand this error message. Haskell appears not to understand
> that 1 is a Num.
>
> Prelude> :t 1
> 1 :: (Num t) => t
> Prelude> :t [1,2,3,4,5]
> [1,2,3,4,5] :: (Num t) => [t]
> Prelude>
>
> Michael
>
> ===
>
> f :: [Int] -> IO [Int]
> f lst = do return lst
>
> main = do let lst = f [1,2,3,4,5]
>   fmap (+1) lst
>
> ===
>
> Prelude> :l test
> [1 of 1] Compiling Main ( test.hs, interpreted )
>
> test.hs:5:17:
> No instance for (Num [Int])
>   arising from the literal `1' at test.hs:5:17
> Possible fix: add an instance declaration for (Num [Int])
> In the second argument of `(+)', namely `1'
> In the first argument of `fmap', namely `(+ 1)'
> In the expression: fmap (+ 1) lst
> Failed, modules loaded: none.
> Prelude>
>
>
> ___
> 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] Gtk 0.12.0, Windows 7, Haskell Platform 2010.2.0.0, build error

2010-12-15 Thread aditya siram
Hi all,
I am having some issues building Gtk2Hs on Windows 7. It completes
compiling the whole thing and then errors out with this message:
Registering gtk-0.12.0...
setup.exe: WARNING: cache is out of date: c:/Program Files/Haskell
Platform/2010.2.0.0\lib\package.conf.d\package.cache
use 'ghc-pkg recache' to fix.
gtk-0.12.0: library-dirs: c:/devel/dist/win32/libpng-1.4.3-1/lib doesn't exist
or isn't a directory (use --force to override)
cabal.exe: Error: some packages failed to install:
gtk-0.12.0 failed during the building phase. The exception was:
ExitFailure 1

I'm not sure why it's looking at
c:/devel/dist/win32/libpng-1.4.3-1/lib and I couldn't find any
reference to this directory in the source tree.

I tried to do a ghc-pkg recache but I get the follow permissions error:
ghc-pkg.exe: c:/Program Files/Haskell
Platform/2010.2.0.0\lib\package.conf.d\package.cache: you don't have
permission to modify this file

I changed this file to be world-writeable but with the same results.

I get the same error if I try and cabal install gtk.

Thanks for your help.
-deech

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


[Haskell-cafe] Connecting to a running Haskell program using GHCI

2010-12-13 Thread aditya siram
Hi all,
I'd like to load a Haskell program into GHCi A and then connect to
GHCi A from GHCI B. Is there any way to do this? This would be handy
(handier than telnet) for demoing and debugging server applications
that use shared resources.

-deech

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


[Haskell-cafe] [SOLVED] Re: Issues Installing Vacuum-Cairo 0.4.1, gtk-0.12.0, GHC 6.12.3, Cairo 0.12.0

2010-12-11 Thread aditya siram
I have fixed the issue on my end. The compiler was apparently confused
by the following import lines :
import qualified Graphics.UI.Gtk as G
import qualified Graphics.UI.Gtk.Gdk.Events as G

I changed the first to :
import qualified Graphics.UI.Gtk as Gtk
and make subsequent changes to the file System/Vacuum/Cairo.hs

A patch file is included.

-deech

On Sat, Dec 11, 2010 at 4:04 PM, aditya siram  wrote:
> Hi all,
> When I try to cabal install vacuum-cairo, I get the following error message :
> Resolving dependencies...
> Configuring vacuum-cairo-0.4.1...
> Preprocessing library vacuum-cairo-0.4.1...
> Building vacuum-cairo-0.4.1...
> [1 of 1] Compiling System.Vacuum.Cairo ( System/Vacuum/Cairo.hs,
> dist/build/System/Vacuum/Cairo.o )
>
> System/Vacuum/Cairo.hs:239:17:
>    Ambiguous occurrence `G.eventKeyName'
>    It could refer to either `G.eventKeyName', imported from
> Graphics.UI.Gtk at System/Vacuum/Cairo.hs:21:0-36
>                          or `G.eventKeyName', imported from
> Graphics.UI.Gtk.Gdk.Events at System/Vacuum/Cairo.hs:22:0-47
>
> System/Vacuum/Cairo.hs:261:16:
>    Ambiguous occurrence `G.eventKeyName'
>    It could refer to either `G.eventKeyName', imported from
> Graphics.UI.Gtk at System/Vacuum/Cairo.hs:21:0-36
>                          or `G.eventKeyName', imported from
> Graphics.UI.Gtk.Gdk.Events at System/Vacuum/Cairo.hs:22:0-47
> cabal: Error: some packages failed to install:
> vacuum-cairo-0.4.1 failed during the building phase. The exception was:
> exit: ExitFailure 1
>
> Can anyone shed some light?
> -deech
>
--- ../../../vacuum-orig/vacuum-cairo-0.4.1/System/Vacuum/Cairo.hs	2010-12-11 17:08:00.0 -0600
+++ ./Cairo.hs	2010-12-11 17:02:50.0 -0600
@@ -18,7 +18,7 @@
 ,   viewFile -- export to .svg file
  ) where
 
-import qualified Graphics.UI.Gtk as G
+import qualified Graphics.UI.Gtk as Gtk
 import qualified Graphics.UI.Gtk.Gdk.Events as G
 import qualified Graphics.Rendering.Cairo as C
 import qualified Graphics.Rendering.Cairo.SVG as C
@@ -46,8 +46,8 @@
 
 
 data Session = Session {
-sWindow  :: !G.Window ,
-sDrawing :: !G.DrawingArea ,
+sWindow  :: !Gtk.Window ,
+sDrawing :: !Gtk.DrawingArea ,
 sSVG :: !C.SVG
 }
 
@@ -60,33 +60,33 @@
 -- | Create a new vacuum session
 newSession :: IO ()
 newSession = do
-G.unsafeInitGUIForThreadedRTS
-window <- G.windowNew
-canvas <- G.drawingAreaNew
+Gtk.unsafeInitGUIForThreadedRTS
+window <- Gtk.windowNew
+canvas <- Gtk.drawingAreaNew
 
 svg<- C.svgNewFromString welcome
 
-G.onKeyPress window $ anyKey (G.widgetDestroy window)
-G.onDestroy  window (takeMVar sessionRef >> G.mainQuit)
+Gtk.onKeyPress window $ anyKey (Gtk.widgetDestroy window)
+Gtk.onDestroy  window (takeMVar sessionRef >> Gtk.mainQuit)
 
-G.onExposeRect canvas $ const $ do
+Gtk.onExposeRect canvas $ const $ do
 --print "EXPOSE"
 withMVar sessionRef $ \(Session _ c svg) ->
  updateCanvas svg c
 return ()
 
 -- not needed.
-G.onExposeRect window $ const $ do
+Gtk.onExposeRect window $ const $ do
 --print "EXPOSE"
 withMVar sessionRef $ \(Session _ c svg) ->
  updateCanvas svg c
 return ()
 
-G.set window [G.containerChild G.:= canvas]
+Gtk.set window [Gtk.containerChild Gtk.:= canvas]
 
-G.windowSetDefaultSize window 400 200
-G.widgetShowAll window
-forkIO G.mainGUI
+Gtk.windowSetDefaultSize window 400 200
+Gtk.widgetShowAll window
+forkIO Gtk.mainGUI
 
 let s = Session {
 sWindow  = window,
@@ -199,7 +199,7 @@
 return ((Session win canvas svg), (canvas))
 
 -- hides expose events!
-G.widgetQueueDraw c
+Gtk.widgetQueueDraw c
 yield
 return ()
 
@@ -214,14 +214,14 @@
svgstring <- myReadProcess exe ["-Tsvg"] dot
writeFile file svgstring
 
-updateCanvas :: C.SVG -> G.DrawingArea  -> IO Bool
+updateCanvas :: C.SVG -> Gtk.DrawingArea  -> IO Bool
 updateCanvas svg canvas = do
-win <- G.widgetGetDrawWindow canvas
-(width, height) <- G.widgetGetSize canvas
+win <- Gtk.widgetGetDrawWindow canvas
+(width, height) <- Gtk.widgetGetSize canvas
 let (w,h)   = (fromIntegral width,fromIntegral height)
 (sw,sh) = C.svgGetSize svg
 
-G.renderWithDrawable win $ do
+Gtk.renderWithDrawable win $ do
 
 C.setAntialias C.AntialiasDefault
 C.setLineCap C.LineCapSquare
@@ -248,26 +248,26 @@
 renderableToWindow chart = do
 svg <- C.svgNewFromString chart
 
-G.unsafeInitGUIForThreadedRTS
+Gtk.unsafeInitGUIForThreadedRTS
 -- G.initGUI
-wind

[Haskell-cafe] Issues Installing Vacuum-Cairo 0.4.1, gtk-0.12.0, GHC 6.12.3, Cairo 0.12.0

2010-12-11 Thread aditya siram
Hi all,
When I try to cabal install vacuum-cairo, I get the following error message :
Resolving dependencies...
Configuring vacuum-cairo-0.4.1...
Preprocessing library vacuum-cairo-0.4.1...
Building vacuum-cairo-0.4.1...
[1 of 1] Compiling System.Vacuum.Cairo ( System/Vacuum/Cairo.hs,
dist/build/System/Vacuum/Cairo.o )

System/Vacuum/Cairo.hs:239:17:
Ambiguous occurrence `G.eventKeyName'
It could refer to either `G.eventKeyName', imported from
Graphics.UI.Gtk at System/Vacuum/Cairo.hs:21:0-36
  or `G.eventKeyName', imported from
Graphics.UI.Gtk.Gdk.Events at System/Vacuum/Cairo.hs:22:0-47

System/Vacuum/Cairo.hs:261:16:
Ambiguous occurrence `G.eventKeyName'
It could refer to either `G.eventKeyName', imported from
Graphics.UI.Gtk at System/Vacuum/Cairo.hs:21:0-36
  or `G.eventKeyName', imported from
Graphics.UI.Gtk.Gdk.Events at System/Vacuum/Cairo.hs:22:0-47
cabal: Error: some packages failed to install:
vacuum-cairo-0.4.1 failed during the building phase. The exception was:
exit: ExitFailure 1

Can anyone shed some light?
-deech

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


Re: [Haskell-cafe] Haskell and javascript

2010-12-10 Thread aditya siram
HJScript[1] ?

[1] http://hackage.haskell.org/package/HJScript-0.5.0

On Fri, Dec 10, 2010 at 9:52 AM, jean-christophe mincke
 wrote:
> Hello,
> I have just discovered WebSharp, a .Net product for web development that
> allows you to write client code in F# and have it translated into
> javascript.
> Does anyone know about somethig similar in Haskell?
>
> Thank you
> Regards
> J-C
>
> ___
> 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] Hackage down?

2010-12-04 Thread aditya siram
What the heck does a "full torque of the electrical bus riser" mean?
Don't get me wrong, it sounds badass.

-deech

On Sat, Dec 4, 2010 at 12:03 PM, Antoine Latter  wrote:
> Thanks, Ross.
>
> Here's a Reddit post:
> http://www.reddit.com/r/haskell/comments/efw38/reminder_hackagehaskellorg_outage_tomorrow_due_to/
>
> Antoine
>
> On Sat, Dec 4, 2010 at 8:20 AM, Ross Paterson  wrote:
>> On Sat, Dec 04, 2010 at 02:01:44PM +, Ozgur Akgun wrote:
>>> http://downforeveryoneorjustme.com/http://hackage.haskell.org
>>
>> Apparently {darcs,hackage}.haskell.org is out for the day -- announced
>> on Reddit but not here.
>>
>> ___
>> 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] Re: [Haskell] intent-typing

2010-11-19 Thread aditya siram
That was a great explanation of phantom types and type-families. I'm
just getting started on understand type families and I was wondering
why you didn't use data families in the truth table structure:
type family Join a b
 type instance Join Safe Safe = Safe
 type instance Join Safe Unsafe = Unsafe
 type instance Join Unsafe Safe = Unsafe
 type instance Join Unsafe Unsafe = Unsafe

My understanding is that since 'type' just produces a type synonym and
the last three type instances are "Unsafe", they are equivalent.
Wouldn't it be better to have  "data instance Join Safe Unsafe ..." so
that the compiler can distinguish between "Join Unsafe Safe", "Join
Safe Unsafe" and "Join Unsafe Unsafe" ?

-deech

2010/11/16 Tillmann Rendel :
> Hi,
>
> Marcus Sundman wrote:
>>
>> Hi, how would one go about implementing (or using if it's supported
>> out-of-the-box) intent-typing* for haskell?
>
> A basic technique is to use newtype declarations to declare separate types
> for separate intents.
>
>  module StringSafety
>           ( SafeString ()
>           , UnsafeString ()
>           , quote
>           , considerUnsafe
>           ) where
>
>    newtype SafeString = SafeString String
>    newtype UnsafeString = UnsafeString String
>
>    considerUnsafe :: String -> UnsafeString
>    considerUnsafe s = UnsafeString s
>
>    quote :: UnsafeString -> SafeString
>    quote (UnsafeString s) = SafeString s' where
>      s' = ... s ...
>
> This module does not export the SafeString and UnsafeString constructors, so
> we can be sure that no other code in the program can invent SafeStrings
> which are not really safe. Every string can be safely treated as unsafe,
> however, so we export a function considerUnsafe which does so.
>
> Now, if we type our interface to the outside world as
>
>  getInput      ::  ... -> UnsafeString
>  sendOutput    ::  SafeString -> ...
>
> we can be sure that a return value from getInput needs to pass through quote
> on its way to sendOutput, because quote is the only way to produce a
> SafeString.
>
>
>
> This guarantuees safety. It has, however, a practical problem: We can't use
> the usual String functions on UnsafeString or SafeString values. For
> instance, we can't concatenate two UnsafeStrings using (++).
>
> A naive solution would be to provide separate (++) functions for unsafe and
> safe strings:
>
>  append_safe :: SafeString -> SafeString -> SafeString
>  append_safe (SafeString x) (SafeString y)
>    = SafeString (x ++ y)
>
>  append_unsafe :: SafeString -> SafeString -> SafeString
>  append_unsafe (UnsafeString x) (UnsafeString y)
>    = UnsafeString (x ++ y)
>
> Note that at least append_safe needs to be implemented in and exported from
> the StringSafety module. That is a good thing, because this function needs
> to be carefully checked for safety. The programmer needs to prove (or
> unit-test, or at least think about) the following theorem:
>
>  If a and b are safe strings, so is a ++ b.
>
> After this fact has been established, other modules are free to use
> append_safe however they like without possibly compromising safety.
>
>
>
> Now, the above approach should work, but is still rather impractical: We
> need to copy the definitions of all String functions for unsafe and safe
> strings. However, since the bodies of all these copies are actually
> identical, so we can use parametric polymorphism to abstract over the
> difference between UnsafeString and SafeString. One way to achieve this is
> to use phantom types.
>
> With phantom types, we declare only a single newtype for both safe and
> unsafe strings, but we annotate that type with an additional flag to
> distinguish safe from unsafe uses.
>
>  module StringSafety
>           ( AnnotatedString ()
>           , Safe ()
>           , Unsafe ()
>           , quote
>           , considerUnsafe
>           , append
>           ) where
>
>    data Safe = Safe
>    data Unsafe = Unsafe
>
>    newtype AnnotatedString safety = AnnotatedString String
>
>    considerUnsafe :: String -> AnnotatedString Unsafe
>    considerUnsafe s = AnnotatedString s
>
>    quote :: AnnotatedString Unsafe -> AnnotatedString Safe
>    quote (AnnotatedString s) = AnnotatedString s' where
>      s' = ... s ...
>
>    append
>      :: AnnotatedString a
>      -> AnnotatedString a
>      -> AnnotatedString a
>
>    append (AnnotatedString x) (AnnotatedString y)
>      = AnnotatedString (x ++ y)
>
> Note that AnnotatedString does not really use its type parameter safety:
> That's why it is called a phantom type. The data constructor AnnotatedString
> can be freely used to convert between safe and unsafe strings, so we better
> not export it from the module. Inside the module, uses of the data
> constructor gives rise to proof obligations as above. So the programmer
> needs to reason that the following is true to justify the implementation and
> export of append:
>
>  If x and y have the same safety level,
>  then (x ++ y) has again that same safety level.
>

Re: [Haskell-cafe] Opportunity for Haskell porting to java at R&D labs in Bay Area, CA

2010-11-10 Thread aditya siram
Googling "haskell java integration" brings up a number of references
to Lambada. Is this project still alive?
-deech

On Wed, Nov 10, 2010 at 4:16 PM, Tom Davies  wrote:
>
> On 11/11/2010, at 7:42 AM, Padma wrote:
>
>> We are looking for a entry level Haskell programmer who has experience in 
>> porting from Haskell to java. Please contact me by Email or you can call me 
>> at 408-207-9367.
>
> You could look at CAL/OpenQuark -- https://github.com/levans/Open-Quark -- 
> which is essentially Haskell 98 for the JVM.
>
> There would still be a porting exercise, because CAL has less syntactic sugar 
> and fewer libraries (and doesn't have the GHC extensions you may use), but it 
> has good (though verbose) Java interoperability.
>
> Tom
>
> ___
> 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] Opportunity for Haskell porting to java at R&D labs in Bay Area, CA

2010-11-10 Thread aditya siram
Not necessarily, there might be some critical jar that cannot be
accessed because Haskell can't talk to the JVM.

-deech

On Wed, Nov 10, 2010 at 2:47 PM, Christopher Done
 wrote:
> On 10 November 2010 21:42, Padma  wrote:
>> We are looking for a entry level Haskell programmer who has experience in
>> porting from Haskell to java.
>
> That sounds like quite a begrudging job. Also kind of sad. It sounds
> like someone wrote a project in Haskell, left and now management has
> said "we need Java because it's easier to higher for". Is this the
> case?
> ___
> 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] Re: "Haskell is a scripting language inspired by Python."

2010-11-04 Thread aditya siram
Not a city, but perhaps an island [1]. Sorry, it had to be done.
-deech

[1] http://en.wikipedia.org/wiki/Java

On Thu, Nov 4, 2010 at 11:51 AM, Stephen Tetley wrote:

> ZF Expressions (aka list comprehensions) date to at least David
> Turner's KRC (St. Andrews Static Language) and Rod Burstall and John
> Darlington's Hope c.1980. Maybe they were present in NPL, the
> predecessor of Hope before that. The Hope paper nods to SETL as an
> influence.
>
> Without interviewing the people concerned its probably impossible to
> actually find out what influenced what - even though list
> comprehensions have a long history the designers of Python might have
> only seen them in Haskell so Python could well have "got" them from
> Haskell.
>
> Hope - An Experimental Applicative language
> http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.18.8135
>
> The language guide is truly strange - maybe it was written by work
> experience students. The Icon entry made me smile, although the SML
> entry where they missed a crucial suffix is good too - "The current
> implementation is Moscow" - what, the city implements a programming a
> language?
> ___
> 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] Re: "Haskell is a scripting language inspired by Python."

2010-11-04 Thread aditya siram
I'm no compiler writer but as a layperson I'd guess for that you'd at least
need a program that could determine if two constructs are equivalent, the
Haskell and Python list comprehension example from 2 emails ago. The only
way I can think to do that is to parse some source in language X and see if
the AST generated is the same as language Y.

As far as something fully automated my intuition tells me that you'd need a
single program that could act as a compiler and/or interpreter for all the
languages you're trying to test. This is the only way, for example, to
automatically determine that variable scoping works the same in Javascript
and Scheme.

-deech

On Thu, Nov 4, 2010 at 10:03 AM, Dupont Corentin
wrote:

> Hello,
> reading this thread a question came to me:
> Is there a way of automatically deriving programming languages ascendancy?
>
> Like biologist can determine the distance between two genotypes, and
> determine a hierarchy between species from that.
>
> Are you aware of researchs made in the field?
>
> On the net I found interesting graphs but no comments on the methodology.
> http://www.levenez.com/lang/
> http://rigaux.org/language-study/diagram.html
>
> Cheers,
> Corentin
>
>
> ___
> 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] who's in charge?

2010-10-28 Thread aditya siram
I understand your frustration at not having free tested libs ready-to-go,
Java/any-other-mainstream-language programmers tend to expect this and
usually get it.

If a lack of libs is a dealbreaker for you and you want to use a functional
programming language with some of Haskell's advantages (like immutability,
lazy data structures and STM) I encourage you to check out Clojure [1] a
nicely designed Lisp. It is tightly integrated in to the JVM and you have
access to all the Java libs you want.

-deech

[1] http://clojure.org/

2010/10/27 Günther Schmidt 

> Hi Malcolm,
>
> well if I would like to point out that, for instance, Haskell exists for a
> lot more than 10 years now, and that, while the language per se rocks, and
> there are cool tools (cabal) and libraries (list, Set, Map), there still
> isn't even a mail client library, I wonder whom to escalate this to, and who
> is going to do something about it.
>
> I understand some parties wish to avoid success at all costs, while others,
> commercial users, benefit from the edge haskell gives them already and which
> probably can help themselves in case of, again, for instance a missing mail
> client library.
>
> And then there is the ones like me, which also want to benefit from the
> edge Haskell gives them over users of other languages and want to develop
> Real World Apps and who cannot easily help themselves in case of a missing
> mail client library.
>
>
> So while there are many aspects of the future of haskell, who effectively
> is it that steers the boat?
>
> Günther
>
> ___
> 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] who's in charge?

2010-10-27 Thread aditya siram
Careful. That might draw some unwarranted comparisons :)
-deech

2010/10/27 Richard O'Keefe 

>
> On 28/10/2010, at 4:38 AM, Günther Schmidt wrote:
> > As we are 10+ years now still without one of the most essential libraries
> any programming language needs I guess it's not that easy. It has just been
> recently that I wanted to do email via haskell. I was very surprised not
> find one in place already.
>
> There is no standard E-mail library for Ada, Fortran, COBOL, PL/I, or a
> great many
> languages.  Fortran and COBOL have been around for fifty years, not ten.
>
>
> ___
> 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] If Python now has a good email library; how challenging is it to call Python from Haskell?

2010-10-27 Thread aditya siram
Are there any C libraries that you can use? I did a google search on email
client in c and failed in an epic fashion but I figure parts of sendmail or
mutt could be used.
-deech

On Wed, Oct 27, 2010 at 12:55 PM, Christopher Done  wrote:

> On 27 October 2010 19:46, Thomas DuBuisson 
> wrote:
> > How does python having an e-mail library change the situation with
> > calling Python from Haskell?
>
> He's commenting, presumably, on the apparently disparate nature of
> Haskell email libraries and the fortuitousness therefore of Python
> having a describadly good email library, not that this changes the
> difficulties in interfacing with Python in general.
>
> On 27 October 2010 19:43,   wrote:
> > :)
>
> glguy's Github interfaces with Python; it involves some C, naturally,
> but it's not complicated: http://github.com/glguy/hpaste
> ___
> 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] Converting Values Between Lua And Haskell

2010-10-24 Thread aditya siram
I was fooled :). Some indication of that on the page would be very helpful.
-deech

On Sun, Oct 24, 2010 at 5:29 AM, Bulat Ziganshin
wrote:

> Hello aditya,
>
> Sunday, October 24, 2010, 8:05:55 AM, you wrote:
>
> HsLua page is nothing more but my fantasy about future HsLua
> development :)  you may find even XXX type where i don't found good
> name :)
>
> > Hi all,
> > The HsLua page [1] says that Int,Double,String,Bool,[a] and [(a,b)]
> > types can be converted to and from Lua values. However the on hslua
> > API page I don't see a StackValue instance [2] for [a] or [(a,b)]. Am I
> missing something?
> >  -deech
>
> > [1]
> >
> http://www.haskell.org/haskellwiki/HsLua#Exchanging_data_between_Haskell_and_Lua_worlds
> > [2]
> >
> http://hackage.haskell.org/packages/archive/hslua/latest/doc/html/Scripting-Lua.html#t:StackValue
> >
>
>
> --
> Best regards,
>  Bulatmailto:bulat.zigans...@gmail.com
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Converting Values Between Lua And Haskell

2010-10-23 Thread aditya siram
Hi all,
The HsLua page [1] says that Int,Double,String,Bool,[a] and [(a,b)] types
can be converted to and from Lua values. However the on hslua API page I
don't see a StackValue instance [2] for [a] or [(a,b)]. Am I missing
something?
-deech

[1]
http://www.haskell.org/haskellwiki/HsLua#Exchanging_data_between_Haskell_and_Lua_worlds
[2]
http://hackage.haskell.org/packages/archive/hslua/latest/doc/html/Scripting-Lua.html#t:StackValue
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Error Calling Lua Function

2010-10-23 Thread aditya siram
That worked. Thank you!
-deech

On Sat, Oct 23, 2010 at 1:49 PM, Claude Heiland-Allen <
claudiusmaxi...@goto10.org> wrote:

> Hi Aditya,
>
> The problem is not that the file was not loaded, but that in Lua, loading a
> file only loads it and does not execute it; Lua is a "dynamic" language, by
> which I mean that definitions are created through execution.
>
> Attached is a simple example, note that there is no proper error checking -
> you probably want to check the results rather than pattern matching against
> constants.
>
> Thanks,
>
>
> Claude
>
>
> On 23/10/10 03:21, aditya siram wrote:
>
>> Hi all,
>> I'm having some issues calling Lua functions from Haskell. I have the
>> following in "Haskell2Lua.lua":
>> function hello ()
>>return "hello world"
>> end
>>
>> And my Haskell file "Haskell2Lua.hs" looks like this:
>> import qualified Scripting.Lua as
>> Lua
>>
>> main =
>> do
>>
>> l<-
>> Lua.newstate
>>
>> Lua.openlibs
>> l
>>
>> succ<- Lua.loadfile l
>> "/Haskell2Lua.lua"
>>
>> print succ
>>
>>
>> Lua.callproc l "hello"
>> ""
>>
>> Lua.close l
>>
>> When I compile and run this file I get:
>> 0
>> Haskell2Lua: user error (attempt to call a nil value)
>>
>> I have tried some variations on calling the function including:
>> Lua.callproc l "hello"
>> Lua.callfunc l "hello"
>> Lua.callfunc l "hello" ""
>>
>> I know the Lua bridge is working because the following works:
>>
>> Lua.callproc l "print" "Hello from Lua"
>>
>> Any help is appreciated!
>> -deech
>>
>
>
> --
> http://claudiusmaximus.goto10.org
>
> ___
> 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] Re: Error Calling Lua Function

2010-10-23 Thread aditya siram
I did that, the slash is a typo. I was looking at the Lua reference manual
and it says that lua_loadfile uses lua_load[1] which outputs 0 if
successful.

Appreciate the quick response.
-deech

[1] http://www.lua.org/manual/5.1/manual.html#lua_load

On Sat, Oct 23, 2010 at 2:49 AM, Gracjan Polak wrote:

>
> Change this:
>
> succ <- Lua.loadfile l "/Haskell2Lua.lua"
>
> into
>
> succ <- Lua.loadfile l "Haskell2Lua.lua"
>
> Note that 0 at the beginning says there was an error loading a script.
>
> I should make it an exception I guess...
>
> --
> Gracjan
>
>
> ___
> 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] Error Calling Lua Function

2010-10-22 Thread aditya siram
Hi all,
I'm having some issues calling Lua functions from Haskell. I have the
following in "Haskell2Lua.lua":
function hello ()
   return "hello world"
end

And my Haskell file "Haskell2Lua.hs" looks like this:
import qualified Scripting.Lua as
Lua

main =
do

l <-
Lua.newstate

Lua.openlibs
l

succ <- Lua.loadfile l
"/Haskell2Lua.lua"

print succ


Lua.callproc l "hello"
""

Lua.close l

When I compile and run this file I get:
0
Haskell2Lua: user error (attempt to call a nil value)

I have tried some variations on calling the function including:
Lua.callproc l "hello"
Lua.callfunc l "hello"
Lua.callfunc l "hello" ""

I know the Lua bridge is working because the following works:

Lua.callproc l "print" "Hello from Lua"

Any help is appreciated!
-deech
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: A rant against the blurb on the Haskell front page

2010-10-18 Thread aditya siram
I agree that "statically typed" comes with a lot of Java/C++ baggage. Is
there some way of saying "really statically typed", or "uncoercable
immutable statically typed values"?

-deech

On Mon, Oct 18, 2010 at 4:08 AM, DavidA  wrote:

> Ketil Malde  malde.org> writes:
>
> >
> > Don Stewart  galois.com> writes:
> >
> > >> Good start, if only the "advanced" were replaced with something more
> > >> characteristic, like "lazy", or "statically typed". Which, BTW, both
> do not
> >
> > > "lazy" and "statically typed" don't mean much to other people. They are
> > > buzz words that mean nothing to many people.
> >
> > But they /are/ defining characteristics of the language, still.  I think
> > they should be mentioned, ideally as links to separate pages (or
> > pop-ups or a "live" sidebar?) that explain what they mean, and why you'd
> > want them.
> >
> > -k
>
> I agree that it is important to highlight the features that are
> characteristic
> of the language. However, I would add that "statically typed" is a turn-off
> for
> some people, so I think it is important to add "with type inference".
>
>
> ___
> 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] Haskell Front Page Ideas

2010-10-17 Thread aditya siram
An honest list of cons mentioned up-front is a great idea and would attract
me to a language. It shows me that the community is grounded, active ,
pragmatic and helpful.

-deech


On Sun, Oct 17, 2010 at 1:45 PM,  wrote:

> How about a bullet list of Haskell's features (maybe pros & cons) might be
> better; followed by a list of a few other languages and their trade-offs.
>
> As Jon Bentley has said, "design" is usually trade-offs but when you can
> come up with something that is a mutual benefit; so much the better. :)
>
>
>
> ___
> 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] I still cannot seem to get a GUI working under Windows.

2010-09-29 Thread aditya siram
I imagine that getting Haskell GUI libraries set and playing nice with
the native GTK libs is a pain on Windows.

That said, I know that Haskell has very nice Lua bindings and Lua has
pretty mature GTK bindings. Has anyone tried developing their UI in
Lua with Haskell doing all the heavy lifting?

-deech

On Wed, Sep 29, 2010 at 1:33 PM, Steve Schafer  wrote:
> On Wed, 29 Sep 2010 20:08:07 +0200, you wrote:
>
>>I think the problem is lack of Windows developers interested in GUIs,
>>and that Windows is not so POSIXy-development-friendly as Linux or OS
>>X. But mostly lack of people interested in that area, I think.
>
> There are lots of Windows developers "interested" in GUIs. On the whole,
> I'd say that Windows developers are far more focused on GUIs than
> non-Windows developers. (See, for example:
>
>  http://mpt.net.nz/archive/2008/08/01/free-software-usability
>
> and
>
>  http://daringfireball.net/2004/04/spray_on_usability
>
> for some discussion of attitudes.)
>
> The issue isn't that there aren't a lot of Windows developers who have
> an interest in Haskell+GUI development. The issue is that nearly every
> Windows developer who looks into Haskell+GUI says, "This stuff sucks,"
> and walks away, because they're interested in developing applications,
> not wrestling with GUI toolkits.
>
> -Steve Schafer
> ___
> 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] Coding conventions for Haskell?

2010-09-27 Thread aditya siram
How do you guys indent long function arguments? I run into this all
the time with the 'maybe' function which takes 3 arguments:
maybe :: b -> (a -> b) -> Maybe a -> b
I usually end up doing things like (pretend the arguments are aligned
if you're not using a monospace font to view this):
maybe do-if-Nothing
  (\x -> do-if-Just x)
  maybe-value
This gets a little unwieldly if the any of the arguments stretch over
one line like:

maybe do-if-Nothing
  (\x -> ...
  ...
  something
  )
  maybe-value


Any advice on indentation? I could avoid the problem by adding a 'let'
or 'where' but sometimes I like to show the entire function without
the user having to scan another definition.
-deech




On Mon, Sep 27, 2010 at 3:57 PM, Andrew Coppin
 wrote:
>  On 27/09/2010 02:44 PM, Daniel Fischer wrote:
>>
>> On Monday 27 September 2010 14:52:18, Henning Thielemann wrote:
>>>
>>> data Foo a b =
>>>      Foo    a
>>>    | Bar      b
>>>    | Foobar a b
>>>
>>> avoids this, at least for the type name "Foo".
>>
>> Tastes vary, but I find that ugly. I much rather have the '=' aligned with
>> the '|'.
>>
>> data Foo a b
>>     = Foo      a
>>     | Bar        b
>>     | Foobar  a b
>>       deriving (Eq, Ord)
>>
>> There, that looks good.
>
> Tastes do indeed vary. To me, both of these are incorrect, and the correct
> way is
>
>  data Foo a b =
>      Foo    a   |
>      Bar      b |
>      Foobar a b
>    deriving (Eq, Ord)
>
> It honestly annoys me that Haddock disagrees with me on this point...
>
> (It also irritates me that almost all Haskell identifiers are camel-case,
> but with an inital lowercase letter. IMHO, the correct thing to do is use
> camel-case for identifiers that must begin with an uppercase letter, and
> underscores for identifiers that must begin with a lowercase letter. Of
> course, my opinion has no effect on the Prelude and so forth.)
>
> I generally try to structure my code so that all blocks indent by 2 spaces,
> and the size of indentation never depends on the length of an identifier. In
> other words, none of this:
>
>  foo x y z = do
>              thing1 x
>              thing2 x y
>              thing3 z
>              ...
>
> Do that a few times and you rapidly end up with lines 300 characters wide.
> (!) Instead, I prefer
>
>  foo x y z = do
>    thing1 x
>    thing2 x y
>    thing3 z
>    ...
>
> But, as they say, everybody has their own ideas about style. I think the
> most important point must surely be that any style is applied
> *consistently*...
>
> ___
> 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] capture of idioms and patterns

2010-09-26 Thread aditya siram
I haven't read this thread completely, but if someone else hasn't
beaten me to it, there are *lots* of Haskell idioms spelled out on the
Haskell Wiki [1] cleverly hidden under the category "Style".
-deech

[1] http://www.haskell.org/haskellwiki/Category:Style

On Fri, Sep 24, 2010 at 5:24 PM, Vo Minh Thu  wrote:
> 2010/9/24 Albert Y. C. Lai :
>> On 10-09-23 04:57 PM, Andrew Coppin wrote:
>>>
>>> If you think that sounds silly, ask some random person (not a computer
>>> programmer, just some random human) how find the sum of a list of
>>> numbers.
>>
>> My reply: to sum 10 numbers, sum 9 numbers, then account for the 10th. More
>> at:
>> http://groups.google.com/group/comp.lang.functional/msg/51df24fbf33b7059
>>
>> Ask some random person how to find page 314 in a book. No one replies "check
>> the 1st page, check the 2nd page, check the 3rd page...". In fact, no one
>> replies in words. Almost everyone shows you how to cut to the middle or the
>> estimated weighted middle (if the book seems to have 1000 pages, they cut
>> near the one-third point), then say "oh, before this" or "oh, after this",
>> repeat. Almost everyone divides and conquers. Almost everyone recurses.
>>
>> I am not a computer programmer.
>>
>> (I know that someone is bound to think, "when confronted with the problem of
>> summing numbers, some people think, 'I know, I will divide and conquer'. Now
>> they have two problems of summing numbers.")
>
> A computer scientist knows how to count the stars in the sky: simply
> count half of them then multiply by two. -- or something like that.
> ___
> 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] Re: "Introducing The Monads" Presentation Slides

2010-09-17 Thread aditya siram
Hi all,
I just resubmitted the slides to Reddit at :
http://www.reddit.com/r/haskell/comments/dfcux/introducing_the_monads_a_practical_tour_of/

I don't see how to delete the old submission at :
http://www.reddit.com/r/haskell/comments/dfazp/introducing_the_monads_a_practical_tour_of/

If the moderators could delete it for me I would appreciate it.

And of course any feedback on the slide is welcome!
-deech


On Fri, Sep 17, 2010 at 2:47 PM, Heinrich Apfelmus
 wrote:
> aditya siram wrote:
>>
>> Ok, I feel dumb. I have the slides hosted elsewhere now and I can't
>> figure out how to change the Reddit link. Any help is appreciated!
>
> You can't change the link on Reddit, but you can delete the old submission
> and make a new one.
>
>
> Regards,
> Heinrich Apfelmus
>
> --
> http://apfelmus.nfshost.com
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] "Introducing The Monads" Presentation Slides

2010-09-17 Thread aditya siram
Ok, I feel dumb. I have the slides hosted elsewhere now and I can't
figure out how to change the Reddit link. Any help is appreciated!
-deech

On Fri, Sep 17, 2010 at 1:16 PM, Matthias Kilian  wrote:
> On Fri, Sep 17, 2010 at 12:54:29PM -0500, aditya siram wrote:
>> Slides shared and Reddited! Feedback is very welcome!
>>
>> http://www.reddit.com/r/haskell/comments/dfazp/introducing_the_monads_a_practical_tour_of/
>
> Oh, come on. A site where you need a flash player to download (or
> view) a PDF? This is the most stupid concept I've seen in the last
> 24 hours.
>
> Ciao,
>        Kili
>
> ps: if you mail your pdf (as an attachment) to k...@dead-parrot.de,
> I'll put it online for download there.
>
> --
> Die Umwelt verlangt von den Jugendlichen ja gar nicht mehr, lesen zu können.
> Da sind nur noch Bilder, Comics.
>                -- Walter Tomann, Erziehungswissenschaftler, in der
>                   Sendung "Hintergrund Politik" zur PISA-Studie
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] "Introducing The Monads" Presentation Slides

2010-09-17 Thread aditya siram
Slides shared and Reddited! Feedback is very welcome!

http://www.reddit.com/r/haskell/comments/dfazp/introducing_the_monads_a_practical_tour_of/

-deech
On Fri, Sep 17, 2010 at 12:38 PM, Ersin Er  wrote:
> http://www.slideshare.net/ ?
>
> and perhaps a link via http://www.reddit.com/r/haskell/
>
> On Fri, Sep 17, 2010 at 20:31, aditya siram  wrote:
>>
>> Hi folks,
>> I just did a presentation on monads and how to use the basic ones
>> (IO,Reader,Writer,State,ReaderT,WriterT,StateT) in practice. I thought
>> the community might want to look at it. Is there some place I can
>> upload the slides (it's just PDF)?
>> -deech
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
>
> --
> Ersin Er
>
> ___
> 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] "Introducing The Monads" Presentation Slides

2010-09-17 Thread aditya siram
Hi folks,
I just did a presentation on monads and how to use the basic ones
(IO,Reader,Writer,State,ReaderT,WriterT,StateT) in practice. I thought
the community might want to look at it. Is there some place I can
upload the slides (it's just PDF)?
-deech
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Differences with Hayoo and Hoogle: Searching For Monoids

2010-09-13 Thread aditya siram
Hi all,
I was trying to read the documentation on monoids and the Sum type.
When I searched Hayoo for "Monoid" or "Data.Monoid", the Data.Monoid
module in "base" did not show up - Hoogle found it without a problem.
The same goes for the "Sum" type, Hayoo does not seem to find it but
Hoogle does.

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


Re: [Haskell-cafe] Haskell Weekly News

2010-09-09 Thread aditya siram
I'd like to do it. Any tips?
-deech

On Thu, Sep 9, 2010 at 9:35 AM, Malcolm Wallace  wrote:
> I miss the Haskell Weekly News.
>
> The most recent issue was published on 8th March 2010.  The volunteer who
> produces it claimed on 27th April that he would be back in action "soon",
> implying that once a couple of weeks' worth of university classes were
> finished, HWN would return.
>
> So in the absence of any visible movement, and it now being Sept, can I
> appeal for a new volunteer to take over?  There is more info here:
>
>    http://www.haskell.org/haskellwiki/HWN
>
> Regards,
>    Malcolm
>
> ___
> 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] Re: Hackage on Linux

2010-08-26 Thread aditya siram
It does make a difference in certain cases. For a 2MB binary to be trivial
it assumes that (1) you are in a developed country (2) you are using a
landline internet connection and not going through your cell-phone company,
although this gap is closing fast.

I feel this India whenever I visit India.  Most people buy into a data
option through their cell phones and the available bandwidth is about an
order of magnitude *below* DSL. So that's one case where 15KB vs. 2MB is a
big deal.

-deech

On Thu, Aug 26, 2010 at 10:50 AM, Andrew Coppin  wrote:

> David Leimbach wrote:
>
>> It's quite practical.  People are obsessed with shared library support but
>> I can not for the life of me figure out why.
>>
>
> Maybe because a simple Hello World program in Haskell becomes about 2MB
> when compiled? (The equivilent C program ends up being 15KB or something,
> which is just a tad smaller.)
>
>
> ___
> 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] A GHC error message puzzle

2010-08-12 Thread aditya siram
When I tried this it never returned, there was no error.
-deech

On Thu, Aug 12, 2010 at 4:04 PM, Yitzchak Gale  wrote:

> Pierre-Etienne Meunier wrote:
> > Does it still work with :
> > writeFile "output" $! process inp
>
> You're right, that changes things. Then the program prints:
>
> <>
>
> That would have given it away, of course. :)
>
> Regards,
> Yitz
> ___
> 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] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread aditya siram
Hi all,
I was experimenting with monad transformers and realized that the stacking
order of the monads can remain unknown until it is used. Take for example
the following code:

import "mtl" Control.Monad.State
import "mtl" Control.Monad.Writer
import "mtl" Control.Monad.Identity

test :: (MonadWriter [Char] m, Num t, MonadState t m) => m ()
test = do
 put 1
 tell "hello"

main = do
 x <- return $ runIdentity $ runStateT (runWriterT test) 1 -- test ::
WriterT String (StateT Int Identity)
 y <- return $ runIdentity $ runWriterT $ runStateT test 1 -- test ::
StateT Int (WriterT String Identity)
 z <- runWriterT $ runStateT test 1-- test ::
StateT Int (WriterT String IO) (((), Int), String)
 print x
 print y
 print z

*Main> main
(((),"hello"),1)
(((),1),"hello")
(((),1),"hello")

Until test is called in 'main' we don't know the order of monads. In fact
even the base monad is not know. All we know is that it uses the State and
Writer monad. In each call to 'test' in main we can determine the stacking
order and the base monad yielding different results. This seems to be a more
flexible way of using monad transformers but I haven't seen this in code
before so is there anything wrong with this style?

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


Re: [Haskell-cafe] Re: Haskell in Industry

2010-08-09 Thread aditya siram
>
> Yes.  I find that out of 10 people I train, only about 2 pick it up
> and run with it.  I'm starting to believe you are either wired for
> functional programming, or you're not.
>
> I disagree that only certain brains are wired for FP. I think your
experience can be explained by people's inability to change in general.  I
guess a good counter argument would be if the people who didn't take to FP
were able to pick up imperative programming easily.

That said it's great that you were able sell Haskell to your company and
follow through by actually delivering. It's really nice that the Haskell
community has these success stories.

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


Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-09 Thread aditya siram
Yes I think that showing the Maybe and List implementation of monads is
essential. They're practical and in a lot of ways they represent two
completely different types of computation demonstrating the flexibility of
the Monad abstraction. Thanks for that suggestion.
-deech


On Mon, Aug 9, 2010 at 4:33 AM, wren ng thornton  wrote:

> aditya siram wrote:
>
>> Thanks all for you suggestions!
>> Upon further reflection I realized that my audience is more pragmatic than
>> theoretical. Instead of emphasizing how monads are constructed and the
>> monad
>> laws I think I want to dive right into the most common and useful monads.
>>
>>> From my vantage point they are (in no particular order) : Reader, Writer,
>>>
>> State, IO, ST, STM, Parsec (have I missed any?) and of course the
>> transformer versions. I am debating whether or not to add [] to the bunch.
>>
>
> Whether you add [] or not, you should definitely include Maybe. Maybe
> captures the most basic kind of fallible computation, so it shows up all
> over the place with pragmatic coding. Compare against null pointers,
> returning -1 to signal error when a positive number is the expected return,
> using 0 to express an infinite limit on some kind of resource, etc. Maybe
> does the same thing, except it does them cleanly and correctly because we
> express the possibility of failure in the type system instead of relying on
> "magic values" to express them. Magic values are even worse than magic
> numbers and other magic constants, IMO.
>
> Once you've explained Maybe, you can mention (Either a) in passing; they
> should figure out the generalization immediately.
>
> --
> Live well,
> ~wren
>
> ___
> 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] Suggestions For An Intro To Monads Talk.

2010-08-06 Thread aditya siram
Thanks all for you suggestions!
Upon further reflection I realized that my audience is more pragmatic than
theoretical. Instead of emphasizing how monads are constructed and the monad
laws I think I want to dive right into the most common and useful monads.
>From my vantage point they are (in no particular order) : Reader, Writer,
State, IO, ST, STM, Parsec (have I missed any?) and of course the
transformer versions. I am debating whether or not to add [] to the bunch.

To explain monads (now that I have Timothy's awesome blog post to reference)
I'll be drawing the parallel between monads and interfaces in Java. And
thanks to Tillman for showing me where the analogy breaks down. Are there
any such parallels in other languages like Perl and Python?

I'm still a little iffy on why the monad concept isn't used in other
languages. From where I sit it seems as though monads really let you play
with the order of evaluation - just because one statement is executed after
another doesn't mean they are executed in that order. I think other
languages don't make this easy.

-deech

On Wed, Aug 4, 2010 at 6:21 PM, Daniel van den Eijkel  wrote:

>  For me, the following two things did the magic, so I'll suggest them:
>
> 1.
> Writing a recursive function that takes a binary tree and returns the same
> tree, but with its leaves enumerated. Each function call takes the tree and
> the counter and returns the resulting tree and the new counter value. The
> pattern that emerges is similar to the state monad. The pattern shows that
> the order of the recursive calls is not ambiguous, unlike in a function that
> just counts the leaves, for example. Changing the order of the recursive
> calls changes the result.
> (code below)
>
> 2.
> Putting the above pattern into a datatype and rewriting the apply-funtion
> for this datatype (>>=) allows only to apply funtions in a non-ambiguous
> way. Not giving a deconstructor for the IO monad forces the programmer to
> decide in which order calls to IO functions have to be done.
>
> I hope this is clear enough; I was able to use the IO monad at the moment I
> realized that Haskell uses this kind of "trick" to ensure that the order of
> execution of function arguments is always well-defined and never ambiguous.
> Of course, there is much more about monads, but this was my entry point.
>
> Best regards
> Daniel
>
>
> code (tree enumeration):
>
> data Tree a = Leaf a | Node (Tree a) (Tree a) deriving Show
>
> enumTree n (Node a b) =
>  let (n', a')  = enumTree n a in
>  let (n'', b') = enumTree n' b in
>  (n'', Node a' b')
>
> enumTree n (Leaf x) = (n+1, Leaf n)
>
>
>
>
>
> aditya siram schrieb:
>
> Hi all,
> I am doing an "Intro To Monads" talk in September [1]. The audience
> consists of experienced non-Haskell developers but they will be familiar
> with basic functional concepts (closures, first-class functions etc.).
>
> I am looking for suggestions on how to introduce the concept and its
> implications. I'd also like to include a section on why monads exist and why
> we don't really see them outside of Haskell.
>
> Has anyone here done a talk like this? And if so what parts of your
> presentation were successful and what would you stay away from.
>
> Thanks for the feedback.
> -deech
>
> [1] It's in St.Louis, Missouri at the St.Louis Perl Mongers 
> meeting<http://St.Louis%20Perl%20Mongers%20meeting>so come on by if you're 
> around!
>
> --
>
> ___
> Haskell-Cafe mailing 
> listhaskell-c...@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


Re: [Haskell-cafe] what's the best environment for haskell work?

2010-08-04 Thread aditya siram
This is slightly OT, but is there a way of getting some Emacs keybindings in
Leksah?

-deech

On Wed, Aug 4, 2010 at 1:01 PM, Hamish Mackenzie <
hamish.k.macken...@googlemail.com> wrote:

> I use Leksah and have done since I started contributing to it.  The best
> way to make it work for you is to use Leksah to fix what you don't like
> about Leksah ;-)  Failing that giving good feedback about bugs and missing
> features is the next best thing.
>
> On 3 Aug 2010, at 18:48, David Virebayre wrote:
> > Trying code completion in comments on string constants, for example.
> > Code completion makes the text jump if you're editing near the bottom
> > of the editor area.
>
> You could turn on Edit Prefs -> GUI Options -> Complete only on Hotkey
>
> Default hotkey is Ctrl+Space
>
> > I like the "tocandy" feature but then it breaks alignment if you open
> > the file in another editor. Something probably fixable by editing the
> > candy file.
>
> Just out of interest which of the candy replacements caused problems.  Some
> of them (such as ->) already are set to include spaces to pad out
> differences.
>
> You can turn candy off by unchecking Configuration -> To Candy
>
> Does your existing editor handle candy better? If so how?
>
> > I'am a bit lost between Workspace and Package, especially when all I
> > want is write a quick single-source haskell program.
>
> We are planning to improve this by adding a default workspace and/or adding
> messages to prompt users if they have not got a workspace or package open.
>
> Basically to get started on a app
>  Workspace -> New Workspace (this file contains a list of packages to open)
>
> I think most users probably only ever need one workspace file.
>
> Next if you have a .cabal file already...
>  Panes -> Workspace (to show the workspace pane)
>  Right click in the workspace Pane and select Add Package
>
> Or if you want to create a new package...
>  Package -> New Package
>  Select a folder whose name matches the desired project name
>  If you just click Save down the bottom you will get a very
>basic executable package with a Main module (but no main function)
>
> To switch between packages in your workspace just double click on it in the
> Workspace pane.
>
> > That's all I can think of right now, I've exagerated a bit when I said
> > "unusable". Leksah is going to be an awesome editor, it's just not
> > ready yet for me.
>
> Thanks for the feedback, please let us know if you think of anything else.
>
> As well as the google forum we now also have #leksah on IRC.
>
> Hamish___
> 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] Haskell Platform OPENGL dependencies

2010-08-04 Thread aditya siram
Hi folks,
I just installed the latest Haskell Platform on a fresh Ubuntu Lucid machine
and I had to install the following packages to satisfy Open GL:
libgmp3-dev,libgl1-mesa-dev, libglu1-mesa-dev, freeglut3-dev

Just thought you might want to document that on the Haskell Platform page.
-deech
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: can Haskell do everyting as we want?

2010-08-04 Thread aditya siram
I think what the OP is asking for is a killer application of Haskell - Ruby,
for example, is great for web programming because of Rails.

The Haskell community is somewhat unique in that it has many killer apps and
that confuses people.  It's great for version control (Darcs), window
managers (XMonad), parsing grammers (Parsec), concurrency (would STM be
considered a killer app?) etc. etc.

People outside the community get flustered because they keep trying to peg
the language as more suitable to one domain than another.

To the OP, while Haskell is not perfect (Jeremy Shaw already mentioned the
garbage-collector issue) it seems as though you could get pretty far before
you hit a wall. So pick a domain and have at it!

-deech

On Wed, Aug 4, 2010 at 10:04 AM, Kevin Jardine wrote:

> In my experience two of the biggest issues in selecting any language
> are the pool of potential programmers and the learning curve for the
> programmers you already have.
>
> If you only need two programmers to do a project and they both know
> Haskell well, then I think Haskell would do almost any job very well.
>
> I also think that the pool of potential Haskell programmers is
> growing. But it is still much smaller than many other languages.
>
> I do think that there is a larger learning curve for Haskell than
> moving from one imperative language (eg. PHP) to another one (eg.
> Ruby).
>
> In my view Haskell programmers are likely to be more productive and
> produce more correct (and possibly even more efficient) code once they
> know the language well.
>
> Kevin
>
> On Aug 4, 4:35 pm, David Leimbach  wrote:
> > On Wed, Aug 4, 2010 at 3:16 AM, Alberto G. Corona  >wrote:
> >
> > > Just to clarify,  I mean: Haskell may be seriously addictive.  Sounds
> like
> > > a joke, but it is not.  I do not recommend it for coding something
> quick and
> > > dirty.
> >
> > I use it for quick and dirty stuff all the time, mainly because what I
> want
> > is often something that can be broken down into stages of processing, and
> > pure functions are really nice for that.
> >
> > If I know the input is coming from a reliable enough stream (like a unix
> > pipe to stdin) I can use functions like "interact" to create filters, or
> > parse some input, and produce some output.
> >
> > It's pretty nice.
> >
> >
> >
> > > 2010/8/4 Alberto G. Corona 
> >
> > > Before entering haskell, please read our disclaimer:
> >
> > >>http://www.haskell.org/pipermail/haskell-cafe/2010-June/079044.html
> >
> > >> You've been warned
> > >> *
> > >> *
> >
> > >> 2010/8/4 Zura_ 
> >
> > >>> As already noted here, Haskell is a general purpose language, but you
> > >>> should
> > >>> take it with a grain of salt.
> > >>> For instance, you can nail with a laptop (provided that you hit the
> place
> > >>> where a HDD is located), but you prefer a hammer :)
> > >>> One thing is if you do it only for enjoyment, in this case you can
> even
> > >>> develop 3D shooter game in Haskell, but when it comes to
> production/real
> > >>> world use, I think it is better to maintain "right tool for the right
> > >>> job"
> > >>> attitude.
> >
> > >>> Regards,
> > >>> Zura
> >
> > >>> Qi Qi-2 wrote:
> >
> > >>> > Is there anyone happen to come into any tasks that haskell is not
> able
> > >>> > to achieve?
> >
> > >>> --
> > >>> View this message in context:
> > >>>
> http://old.nabble.com/can-Haskell-do-everyting-as-we-want--tp29341176...
> > >>> Sent from the Haskell - Haskell-Cafe mailing list archive at
> Nabble.com.
> >
> > >>> ___
> > >>> Haskell-Cafe mailing list
> > >>> haskell-c...@haskell.org
> > >>>http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> > > ___
> > > Haskell-Cafe mailing list
> > > haskell-c...@haskell.org
> > >http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> >
> >
> > ___
> > Haskell-Cafe mailing list
> > haskell-c...@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] Preview the new haddock look and take a short survey

2010-08-04 Thread aditya siram
I really like the color scheme and the Javadoc looking frames.

One suggestion I can make is to have the index show all the functions with
type signatures without having to pick a letter. A lot of times I'll be
looking for a function of a certain signature as opposed to a name. Indeed
an index of type signatures would great! I remember wishing I had this when
trying the understand the Parsec package.

-deech

On Wed, Aug 4, 2010 at 8:55 AM, Yitzchak Gale  wrote:

> Mark Lentczner wrote:
> > The Haddock team...
> > Please take a look, and then give us your feedback
>
> Very very nice. I took the survey, but here are some comments
> I left out.
>
> I like the idea of the Snappy style the best, but there are two
> serious problems with it, at least in my browser (Safari):
>
> 1. The black on dark blue of the "Snap Packages" title makes it
> nearly unreadable for me.
> 2. The wide fonts stretch things out so far on my screen that the
> page becomes almost unusable.
>
> The other styles are fine, I would use them instead.
>
> Here is a comment I'll repeat from the survey because of its
> importance: Please add a "collapse all" button for the tree on
> the contents page. For me, that is perhaps the most urgent
> thing missing in all of Haddock. It would make that tree so
> much more usable.
>
> Thanks for the great work,
> Yitz
> ___
> 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] Suggestions For An Intro To Monads Talk.

2010-08-03 Thread aditya siram
Thanks for reminding me. Although I wonder if there is a difference between
drawing metaphors (monads are burritos etc.) and drawing parallels. For
example in the beginning it was useful for me to think of monads (and
typeclasses really) as approximating Java interfaces. Now this parallel dies
pretty quickly but it was something for me to hold onto while internalizing
the concepts. Is there a danger in telling people this?

-deech

On Tue, Aug 3, 2010 at 5:36 PM, Dan Piponi  wrote:

> On Tue, Aug 3, 2010 at 2:51 PM, aditya siram 
> wrote:
> > I am doing an "Intro To Monads" talk in September [1].
> > ...what would you stay away from.
>
> Some things to stay away from:
>
>
> http://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/
>
> (Though I secretly harbour a belief that there is a correct metaphor
> that everyone should be using. :-)
> --
> Dan
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-03 Thread aditya siram
Hi all,
I am doing an "Intro To Monads" talk in September [1]. The audience consists
of experienced non-Haskell developers but they will be familiar with basic
functional concepts (closures, first-class functions etc.).

I am looking for suggestions on how to introduce the concept and its
implications. I'd also like to include a section on why monads exist and why
we don't really see them outside of Haskell.

Has anyone here done a talk like this? And if so what parts of your
presentation were successful and what would you stay away from.

Thanks for the feedback.
-deech

[1] It's in St.Louis, Missouri at the St.Louis Perl Mongers
meetingso come on by if
you're around!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-02 Thread aditya siram
Agreed. In fact I have the most trouble imagining what Haskell code looked
like before monads.

-deech

On Mon, Aug 2, 2010 at 6:34 PM, Richard O'Keefe  wrote:

> The thing that I found hardest to understand about monads is that
> they are used to obtain very special consequences (fitting things
> like I/O and updatable arrays into a functional language) without
> actually involving any special machinery.  Whenever you look for
> the magic, it's nowhere.  But it's happening none the less.  It's
> really the monad laws that matter; they express _just_ enough of
> the informal notion of doing things one after the other to be
> useful for side-effective things that need to be done one after
> the other without expressing so much that they preclude
> informally pure things like lists and maybes.
>
> There's a thing I'm still finding extremely hard about monads,
> and that's how to get into the frame of mind where inventing
> things like Monad and Applicative and Arrows is something I could
> do myself.  Functor, yes, I could have invented Functor.
> But not the others.
>
>
> ___
> 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: Takusen 0.8.6

2010-08-01 Thread aditya siram
I meant the links to the API docs.
-deech

[1]
http://hackage.haskell.org/packages/archive/Takusen/0.8.6/doc/html/Database-ODBC-Enumerator.html

On Sun, Aug 1, 2010 at 1:46 PM, Don Stewart  wrote:

>
> aditya.siram:
> > Why are the Takusen module links on Hackage dead?
>
> Hmm.  The links look fine:
>
>http://hackage.haskell.org/package/Takusen-0.8.6
>
> > this opportunity to request a Takusen tutorial and to thank you for this
>
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: Takusen 0.8.6

2010-08-01 Thread aditya siram
Why are the Takusen module links on Hackage dead? I would also like to take
this opportunity to request a Takusen tutorial and to thank you for this
innovative library.
-deech

On Sun, Aug 1, 2010 at 12:59 PM, Jason Dagit  wrote:

>
>
> On Sun, Aug 1, 2010 at 9:10 AM, David Anderson  wrote:
> >
> > Congrats on the release.
> >
> > Just one humble suggestion: your email assumes that the reader already
> > knows what Takusen is. Reading the email, all I can infer is that it
> > has something to do with databases, because of the ODBC reference. The
> > only link in the email also does nothing to explain, since it just
> > links to a ball of code. The README there also assumes that I already
> > know that I want Takusen, and so doesn't bother to explain what it
> > does, only how to use it.
>
> Sorry about that.  The description from hackage:
> http://hackage.haskell.org/package/Takusen
>
> Takusen: Database library with left-fold interface, for PostgreSQL, Oracle,
> SQLite, ODBC.
>
> Takusen is a DBMS access library. Like HSQL and HDBC, we support arbitrary
> SQL statements (currently strings, extensible to anything that can be
> converted to a string).
>
> Takusen's unique selling point is safety and efficiency. We statically
> ensure all acquired database resources - such as cursors, connections, and
> statement handles - are released, exactly once, at predictable times.
> Takusen can avoid loading the whole result set in memory, and so can handle
> queries returning millions of rows in constant space. Takusen also supports
> automatic marshalling and unmarshalling of results and query parameters.
> These benefits come from the design of query result processing around a
> left-fold enumerator.
>
> Currently we fully support ODBC, Oracle, Sqlite, and PostgreSQL.
>
>
>
>> Ideally, release announcements should always include a 1-sentence
>> executive summary of what the project is, before heading on to what is
>> new. Say, "The Takusen team would like to announce the latest release
>> of Takusen, 0.8.6. Takusen is > not quite sure>. This is primarily a bugfix release..."
>>
>
> Thanks, I'll remember that.
>
> Jason
>
> ___
> 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] Can we come out of a monad?

2010-07-31 Thread aditya siram
Each monad implementation is different. In the case of the State monad your
'execState' call extracts a non-monadic value.

Of the basic monads I found the State monad the most confusing because of
the complicated way in which it threads state through the computation. In
the end, desugaring the do-notation and tracing through the code manually
was the most helpful to me so I encourage you to do the same. After I did
this a couple of times I got the gist of it.

I have attached a trace of your State monad functions 'modifiedImage' and
'drawPixels' which shows the intermediate stages explicitly. If you follow
the steps you will see that there is no magic in how a non-monadic value is
extracted from the State monad.

Let me know if I can be of more help.

-deech


When I am looking at a confusing monad like the State monad

On Fri, Jul 30, 2010 at 1:23 AM, C K Kashyap  wrote:

> Hi,
> In the code here -
> http://hpaste.org/fastcgi/hpaste.fcgi/view?id=28393#a28393
> If I look at the type of modifiedImage, its simply ByteString - but isn't
> it actually getting into and back out of the state monad? I am of the
> understanding that once you into a monad, you cant get out of it? Is this
> breaking the "monad" scheme?
> --
> Regards,
> Kashyap
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-- First we need some pieces from the Monad library 
newtype State s a = State {runState :: a -> (a,s)}
  = runState :: State s a -> (a -> (a,s)) 

execState = snd (runState m s)

-- Bind operation for State monads
m >>= k = State $ \s -> let
  (a, s') = runState m s
in runState (k a) s'
  
-- Your example with the last two 'setPixel ...' lines removed for simplicity
drawPixels = do
  setPixel 5 10 (255, 255, 255)
  setPixel 100 100 (255, 0, 0)
  setPixel 101 100 (255, 0, 0)
  
modifiedImage = execState drawPixels  blankImage

-- Your example with each call to 'setPixel ...' replaced with some shortened
-- names. So, for example, pix_5_10 = setPixel 5 10 (255,255,255)
drawPixels = do
  pix_5_10
  pix_100_100
  pix_101_100
 
-- Desugared version of drawPixel
drawPixels
  = pix_5_10  >>=
\_ -> pix_100_100 >>= 
\_ -> pix101_100

-- Trace of drawPixels  
drawPixels
  = State $ \s -> let (a,s') = runState (State (\a -> ((), pix_5_10 a))) s
in runState ((\_ -> State (\a -> ((),pix_100_100 a)) >>=
  \_ -> State (\a -> ((),pix_101_100 a))) a)
 s'
   
  = State $ \s -> runState ((\_ -> State $ \a -> ((),pix_100_100 a) >>=
 \_ -> State $ \a -> ((),pix_101_100 a)) ())
(pix_5_10 s)
  = State $ \s -> runState (State $
   \s -> runState (State $ \a -> ((),pix_101_100 
a)) $ pix_100_100 s)
   (pix_5_10 s)
  = State $ \s -> runState (State $
   \s -> (\a -> ((),pix_101_100 a)) $ pix_100_100 s)
   (pix_5_10 s')
  = State $ \s -> (\s -> \a -> ((),pix_101_100 a) $ pix_100_100 s) pix_5_10 s   


-- Trace of modifiedImage
modifiedImage = execState drawPixels blankImage
  = execState (State $ \s -> (\s -> \a -> ((),pix_101_100 a) $ 
pix_100_100 s) pix_5_10 s) blankImage
  = snd (\s -> (\s -> \a -> ((),pix_101_100 a) $ pix_100_100 s) 
pix_5_10 s) blankImage
  = snd ((\s -> (\a -> ((),pix_101_100 a)) $ pix_100_100 s) $ 
pix_5_10 blankImage
  = snd ((\a -> ((),pix_101_100 a)) pix_100_100 $ pix_5_10 
blankImage)
  = snd ((), pix_101_100 $ pix_100_100 $ pix_5_10 blankImage)
  = pix_101_100 $ pix_100_100 $ pix_5_10 blankImage

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


  1   2   >