Re: [Haskell-cafe] definition of the term "combinator"

2013-08-26 Thread Kristopher Micinski
I've always stuck to the definition of a closed lambda term (the Y, U, S,
K, etc... combinators, for example). The colloquial usage generally implies
something like "a higher order function that does something interesting
(and possibly DSL-y)."

Kris



On Sat, Aug 24, 2013 at 12:09 AM, damodar kulkarni
wrote:

> Hello,
> The word "combinator" is used several times in the Haskell community. e.g.
> parser combinator, combinator library etc.
>
> Is it exactly the same term that is used in the "combinatory logic" ?
> A combinator is a higher-order function that uses *only function
> application* and earlier defined combinators to define a result from its
> arguments. [1]
>
> It seems, the term combinator as in, say, "parser combinator", doesn't
> have much to do with the "*only function application*" requirement of the
> "combinatory logic", per se.
>
> If the above observation holds, is the term combinator as used in the
> Haskell community, properly defined?
>
> In other words:
>
> Where can I find a formal and precise definition of the term "combinator",
> as a term used by the Haskell community to describe "something"?
>
> Ref: http://en.wikipedia.org/wiki/Combinatory_logic
>
> Thanks and regards,
> -Damodar Kulkarni
>
>
> ___
> 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 can I use ghci more wisely?

2013-07-23 Thread Kristopher Micinski
Knowing whether a computation will terminate is in general the halting
problem, so immediately you're looking at a syntactic restriction.
Here the only ones I can think of are artificial at best (i.e., they
don't work for examples more than what you've shown here):

http://trac.haskell.org/haskell-platform/ticket/180

There was some discussion [1] on putting a limit to what the
interpreter prints out.  Off the top of my head I suppose a hacky way
to do this would be to define a new type deriving show in a way that
printed out the list to some bounded depth.

Kris

[1] http://projects.haskell.org/pipermail/haskell-platform/2011-July/001619.html

On Tue, Jul 23, 2013 at 10:30 PM, yi lu  wrote:
> I am wondering how can I ask ghci to show an infinite list wisely.
> When I type
>
> fst ([1..],[1..10])
>
> The result is what as you may guess
>
> 1,2,3,4,...(continues to show, cut now)
>
> How could I may ghci show
>
> [1..]
>
> this wise way not the long long long list itself?
>
> Yi
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

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


Re: [Haskell-cafe] Interfacing Java/Haskell

2013-05-28 Thread Kristopher Micinski
Awesome!

I was hoping that someone would do this, and I'd be really happy to see
what could be done here.

This is the big crutch of using Haskell on Android is obviously that the
API sort of sucks for Haskell...

Kris


On Tue, May 28, 2013 at 2:01 PM, CJ van den Berg  wrote:

> No, you can go both ways. You can call Haskell from Java and Java from
> Haskell.
>
> Write Android Apps in Haskell will of course be just the same as writing
> Android Apps in Java. That’s just the price you pay for having full API
> access. There is of course nothing preventing someone from creating more
> idiomatic Haskell GUI libraries for Android on top of the API bindings.
>
> On 2013-05-28 15:37, Kristopher Micinski wrote:
> > I guess you can't really go from native -> framework code like this, so
> > this would really make sense only for native methods that are self
> > contained.  Is this right?  It seems like this would imply that you can
> > only write parts of an app's computation in Haskell, not the whole
> > thing.  But maybe I'm wrong.  I have seen people that write apps in
> > native / managed code integrating in a reasonable way, but it's very
> > ugly afaik.
> >
> > Kris
> >
> >
> > On Tue, May 28, 2013 at 9:35 AM, Kristopher Micinski
> > mailto:krismicin...@gmail.com>> wrote:
> >
> > I'm also interested in seeing this.
> >
> > Have you ported the Haskell runtime to Android?  It seems like this
> > should be able to be done, and through the JNI it seems like you
> > should be able to get the system API (albeit, ugly).
> >
> > However, I'd be really happy to see this setup if you were willing
> > to put it up somewhere so I could hack on it too.
> >
> > Kris
> >
> >
> > On Mon, May 27, 2013 at 8:07 PM, Manuel M T Chakravarty
> > mailto:c...@cse.unsw.edu.au>> wrote:
> >
> > CJ van den Berg mailto:c...@vdbonline.com>>:
> > > I have successfully written Java/Haskell programs using the
> Java
> > > Native Interface. You can find my JNI to Haskell binding
> > library at
> > > https://github.com/neurocyte/foreign-jni. I am primarily using
> > it to
> > > write Android Apps with Haskell,
> >
> > Just out of curiosity, have you got any complete apps that you
> > built that way? Are they in the Google Store?
> >
> > Manuel
> >
> >
> > ___
> > Haskell-Cafe mailing list
> > Haskell-Cafe@haskell.org <mailto:Haskell-Cafe@haskell.org>
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> >
> >
>
>
> --
> CJ van den Berg
>
> mailto:c...@vdbonline.com
> xmpp:neuroc...@gmail.com
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Interfacing Java/Haskell

2013-05-28 Thread Kristopher Micinski
I guess you can't really go from native -> framework code like this, so
this would really make sense only for native methods that are self
contained.  Is this right?  It seems like this would imply that you can
only write parts of an app's computation in Haskell, not the whole thing.
 But maybe I'm wrong.  I have seen people that write apps in native /
managed code integrating in a reasonable way, but it's very ugly afaik.

Kris


On Tue, May 28, 2013 at 9:35 AM, Kristopher Micinski  wrote:

> I'm also interested in seeing this.
>
> Have you ported the Haskell runtime to Android?  It seems like this should
> be able to be done, and through the JNI it seems like you should be able to
> get the system API (albeit, ugly).
>
> However, I'd be really happy to see this setup if you were willing to put
> it up somewhere so I could hack on it too.
>
> Kris
>
>
> On Mon, May 27, 2013 at 8:07 PM, Manuel M T Chakravarty <
> c...@cse.unsw.edu.au> wrote:
>
>> CJ van den Berg :
>> > I have successfully written Java/Haskell programs using the Java
>> > Native Interface. You can find my JNI to Haskell binding library at
>> > https://github.com/neurocyte/foreign-jni. I am primarily using it to
>> > write Android Apps with Haskell,
>>
>> Just out of curiosity, have you got any complete apps that you built that
>> way? Are they in the Google Store?
>>
>> Manuel
>>
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Interfacing Java/Haskell

2013-05-28 Thread Kristopher Micinski
I'm also interested in seeing this.

Have you ported the Haskell runtime to Android?  It seems like this should
be able to be done, and through the JNI it seems like you should be able to
get the system API (albeit, ugly).

However, I'd be really happy to see this setup if you were willing to put
it up somewhere so I could hack on it too.

Kris


On Mon, May 27, 2013 at 8:07 PM, Manuel M T Chakravarty <
c...@cse.unsw.edu.au> wrote:

> CJ van den Berg :
> > I have successfully written Java/Haskell programs using the Java
> > Native Interface. You can find my JNI to Haskell binding library at
> > https://github.com/neurocyte/foreign-jni. I am primarily using it to
> > write Android Apps with Haskell,
>
> Just out of curiosity, have you got any complete apps that you built that
> way? Are they in the Google Store?
>
> Manuel
>
>
> ___
> 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] Google Summer of Code Proposal - Communicating with mobile devices

2013-05-04 Thread Kristopher Micinski
Marcos,

Great to see you've revised a copy of this.  I've often felt that push
communication to devices has a very continuation-y flavor, and I think
having something in a web framework to express this would be great.

It looks like a large part of your time may be spent developing demo
apps, which is too bad, since ideally (for a Haskell project) you'd
want to spend as much time as possible writing in Haskell :-).
Perhaps you could write a fleshed out demo app for one environment
(iOS, Android, etc..) and then shallower examples for the rest.  (In
theory of course, you don't even need to write sample apps for most
platforms, since the push API should be an abstraction layer above
that...).

Should this project make it through to be one of Haskell's GSOC
projects, I'd be happy to chat with you about your development.

Kris

On Thu, May 2, 2013 at 8:53 PM, Marcos Pividori
 wrote:
> Greetings,
>
> I am a Computer Science student from Argentina. I am interested in working
> this summer in a project related to Haskell for the Google Summer of Code. I
> have been discussing my idea with Michael Snoyman in order to have a clearer
> idea. Now, I would like to know the community interest in this project.
>
> I want to develop a server-side library in Haskell for sending push
> notifications to devices running different OS, such as Android, iOS, Windows
> Phone, BlackBerry, and so on.
>
> To pass a subject, I have recently worked with Yesod (a Web Framework based
> in Haskell) developing a server to comunicate with Android-powered devices
> through Google Cloud Messaging. (It is available:
> https://github.com/MarcosPividori/Yesod-server-for-GCM – It is a Spanish
> commented version because it was a project for my University, I will replace
> it for an English version in the next weeks)
>
> To develop this project, I have read a lot about this service and Yesod
> libraries, and I developed two programs, a server written in Haskell and an
> Android application for mobile phones. Also, I developed an EDSL to write
> programs which exchange information with the devices.
>
> I would be really grateful if you could give me your opinion about this
> project and the proposal. I want some feedback in order to know if this
> would be a useful tool and what you would like to get out of it.
>
> Communicating with mobile devices
>
>
> Abstract
>
> The aim of this project is to develop a server-side library in Haskell for
> sending push notifications to devices running different OS, such as Android,
> iOS, Windows Phone, BlackBerry, and so on.
>
> The fact is that every company is developing Push Notification services, and
> these are very similar. Then, I want to find the fundamental concepts to
> construct a library which enable to configure the options for the different
> services and send messages easily.
>
> When I say they are very similar, I refer to the fact that they all are
> asynchronous, best-effort services that offers third-party developers a
> channel to send data to apps from a cloud service in a power-efficient
> manner. The most popular are:
>
>- Google Cloud Messaging (Android)
>
>- Apple Push Notification Service (iPhone / iPad)
>
>- Microsoft Push Notification Service (Windows Phone)
>
>- BlackBerry Push Service (BlackBerry)
>
>- Windows Push Notification Services (Windows 8)
>
>- etc.
>
> Once we have this libraries, I will investigate the possibility of mainting
> a "back and forth" communication between a server and mobile devices and I
> will develop a library to handle this.
>
>
> Motivation and expected benefits
>
> I think this idea would be very useful because it will allow all Haskell
> developers to open to a new world of mobile devices and to build useful
> programs/services that interact with them.
>
> Pushing data to smartphones provides users with instant access to desired
> updates as they happen, such as news and weather, sports scores, stock
> prices and other time-sensitive content. The push services provide an
> efficient way to quickly push timely information updates to many smartphones
> at once, in a centrally managed and controlled manner.
>
> Generally, you can also be very selective in who you send information to,
> including individual customers or many customers (multicast).
>
> This services minimizes the impact on the smartphones battery life. Instead
> of actively checking for new data, the applications can remain closed. Once
> the data is delivered, the application can be launched in the background to
> process it as needed.
>
> This processes offer an alternative to other less efficient methods, such as
> polling, where a device regularly polls an application server to see if new
> content is available.
>
> The main differences between the services, refer to details as: the maxim
> payload length, the quality of service, queueing the messages or not, and
> the time limit for this, the way the messages are handled in the devices,
> etc.
>
> As all the

Re: [Haskell-cafe] GSoC Push Notifications project - communicating with mobile devices

2013-04-29 Thread Kristopher Micinski
On Mon, Apr 29, 2013 at 4:46 PM, Marcos Pividori
 wrote:
> Hi, thanks for your response! this really help me.
>
> * About the code in Spanish: I will replace it for an English version in the
> next weeks. As Michael said, I had to write it in Spanish because it was a
> project for my university. Sorry, I know it is not clear now.
>

No worries, I don't think this makes it bad, just harder to read for
English speakers

> * Kristopher, thanks for your comments and availability. Yes, I am looking
> to provide a Haskell API to interface with these different push notification
> services. I know that maybe it isn't enough to fill up a summer, so I will
> get into account this ideas you gave me. I am thinking about some useful
> tools I could provide to people programming for mobile devices.

I would also be interested in hearing about what you come up with.  I
have a lot of experience with mobile hacking, and I'd be glad to help
you validate ideas as they come to you, or point you at related
material.

>>"I would suggest also adding to your schedule writing up a
>> Yesod app which has "back and forth" communication with a device,
>> seeing what common problems pop up, and then writing an API for
>> handling *that* as well.  (That may broaden the scope of your project
>> enough.)"
>
>   I created this "back and forth" communication for the project I mentioned
> before. But, a lot of things could be improved. For example, about
> mantaining a state of the connection and being able to manage with a lot of
> devices at the same time. (As I implemented this, I think it wont work
> really well with a lot of devices). And I could develop a demo app for each
> OS (Android, iOS, Windows Phone, etc) to manage this communication.
>   I 'll continue investigating, every contribution is welcome!

The key aspects are to use Haskell to write as little as boilerplate
code as possible.  Then identify the common elements of the API for
each and write a common API.

That strikes me as the simple part.

I'm not sure if it's sensible or not, but maybe it would be possible
to formalize this "back and forth" computation using something similar
to session types.  Maybe next steps would be to automatically take the
types in the program and generate a contract for the JSON sent between
the device and server, which might give you some fun experience in
type level programming.  This is very hand wavy, so I'm not sure if
that's realistic or not...

Kris

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


Re: [Haskell-cafe] Fwd: Google Summer of Code, news

2013-04-29 Thread Kristopher Micinski
I second that advice!  I can technically read Spanish, but I find the
complexity of the language barrier compounded with trying to
understand the code becomes more confusing than I'd prefer :-).

Kris


On Sun, Apr 28, 2013 at 2:19 PM, Mateusz Kowalczyk
 wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 28/04/13 18:37, Marcos Pividori wrote:
>> Greetings,
>>
>> I am a Computer Science student from Argentina. I am interested in
>> working this summer in a project related to Haskell for the Google
>> Summer of Code. I have been discussing my idea with Michael Snoyman
>> in order to have a clearer idea. Now, I would like to know the
>> community interest in this project.
>>
>> I want to develop a server-side library in Haskell for sending
>> push notifications to devices running different OS, such as
>> Android, iOS, Windows Phone, BlackBerry, and so on.
>>
>> To pass a subject, I have recently worked with Yesod (a Web
>> Framework based in Haskell) developing a server to comunicate with
>> Android-powered devices through Google Cloud Messaging.  (It is
>> available: https://github.com/MarcosPividori/Yesod-server-for-GCM
>> )
>>
>> To develop this project, I have read a lot about this service and
>> Yesod libraries, and I developed two programs, a server written in
>> Haskell and an Android application for mobile phones. Also, I
>> developed an EDSL to write programs which exchange information with
>> the devices.
>>
>> I would be grateful if you could give me your opinion about this
>> project and the proposal I am starting to write.
>
> While I don't have anything to contribute to the project idea itself,
> I had a look at your code on GitHub and I'd like to recommend that in
> the future, when writing code that will get published and used by
> others, you use English. This especially applies to projects aimed to
> benefit a wider community such as this one. You seem to be mixing the
> two together which doesn't help readability either.
>
>
> - --
> Mateusz K.
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.19 (GNU/Linux)
>
> iQIcBAEBAgAGBQJRfWhMAAoJEM1mucMq2pqXJH8P/RqWzAHFlbkLPRSzRK3w+Us2
> I+VDOGxF6627RwWSX3P5gY84t8lhGQZ8M9voGptKnNE+2xmArtqQIn6a9Jj01o3n
> PcV6SuacG5qNpHawQdVXSFoIGkQ9tNhSDu4HYgXTRQD1tptxd31pKi9gN2EE6ieA
> HgdR6g688edLjdfbGj18CDNnFxIJhzsFYoqaNgBZB4ZpcCisQzdkwGELx8c3+fa2
> deSbsvA808q/xPiFZ6DDCOF0aXQmvQwtVdCdhyrn4BPMhGF2da9zqcy3VNPHWMd5
> VNnw4USY1vVdsTY6fKts5IyuNhIl7WTGypNUbIMl3gCpH1RWgO8FbKZQmyvosPPv
> xCA7qpPVkc8sg2qSBiQyJ66upg5503bCoijNYxGmCAaFm83bJdUgwrhnOBoyguPC
> S86g6zNUrbV6oQDAPy3unOKLlCGJhlQgEx9dbXPDCQiqWeUqhVipqxf0WHDcTPMW
> prjWzqZTJkm1kq11G4Ues4sXpJDzG0syWroaO4ah0A6aCZzuFFX8NqcQvEufzRCS
> ydOF9Qgr5nuVcBndjekYw9uxA6UtRDKoyvmvr0y5TDfk7w42dC/qPOhK5xkndz7u
> pjXnIGanqBur1B5Fw5jfilzc5eViOYDGGtZqz4/mKV6lfQclTljTVI461HrSQW+H
> SVdK4oqvGU0ZCD94BBHv
> =+KLZ
> -END PGP SIGNATURE-
>
> ___
> 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] GSoC Push Notifications project - communicating with mobile devices

2013-04-29 Thread Kristopher Micinski
I'm not sure if I understand what you want to do..  Am I correct in
thinking that you are looking to provide a Haskell API to interface
with these push notification services, so that (e.g.,) a Yesod app
could send push notifications to a mobile device?

I have a good amount of experience working with Android hacking and
know stuff about GCM (formerly the now-deprecated C2DM): I would be
willing to (informally) advise you of the details on that side for
your project, should this be accepted.

Most of the time "power efficient" means that there are as few things
as possible on the device which retain a persistent connection to the
server.  This is why GCM wins: there's only one app which does the
"heavy lifting" of maintaining frequent contact with the remote
server.

You might also look at Parse (recently acquired by Facebook), which
provides a similar service with a little more flexibility.

Unfortunately, I'm not sure how much work this involves, and I'm not
certain it is enough to constitue a GSoC projecl.  To give you some
idea: the corresponding Ruby gem (http://rubygems.org/gems/gcm) is
*extremely* small, though it uses metaprogramming on the Ruby side.

The thing that makes these APIs simple to write is that implementing
GCM is literally just as easy as writing think wrapper around a JSON
API provided by Google.

I've also never used APNS, but it's corresponding gem looks extremely
similar and involves similar techniques.

So I don't think this is a bad project, but I think the time estimates
may be unrealistic: I would estimate that it should take you around 1
week to get an API for GCM (for example), most of that time would be
studying how to do JSON communication with the server (presumably
using conduit).

One thing you haven't mentioned is this: once you send a push
notification to a device, it sometimes "calls you back" by making a
HTTP request to your server.  I'm not sure if this code really
constitutes as boilerplate or not: maybe it does.  I would suggest
also adding to your schedule writing up a Yesod app which has "back
and forth" communication with a device, seeing what common problems
pop up, and then writing an API for handling *that* as well.  (That
may broaden the scope of your project enough.)

Kris

On Sun, Apr 28, 2013 at 5:41 PM, Marcos Pividori
 wrote:
> Sorry, I am resending this email because I didn't write a correct title
> before.
> ---
>
> Greetings,
>
> I am a Computer Science student from Argentina. I am interested in working
> this summer in a project related to Haskell for the Google Summer of Code. I
> have been discussing my idea with Michael Snoyman in order to have a clearer
> idea. Now, I would like to know the community interest in this project.
>
> I want to develop a server-side library in Haskell for sending push
> notifications to devices running different OS, such as Android, iOS, Windows
> Phone, BlackBerry, and so on.
>
> To pass a subject, I have recently worked with Yesod (a Web Framework based
> in Haskell) developing a server to comunicate with Android-powered devices
> through Google Cloud Messaging.  (It is available:
> https://github.com/MarcosPividori/Yesod-server-for-GCM )
>
> To develop this project, I have read a lot about this service and Yesod
> libraries, and I developed two programs, a server written in Haskell and an
> Android application for mobile phones. Also, I developed an EDSL to write
> programs which exchange information with the devices.
>
> I would be grateful if you could give me your opinion about this project and
> the proposal I am starting to write.
>
>
> Proposal GSoC 2013:
>
>
> Abstract
>
> The aim of this project is to develop a server-side library in Haskell for
> sending push notifications to devices running different OS, such as Android,
> iOS, Windows Phone, BlackBerry, and so on.
>
> The fact is that every company is developing Push Notification services, and
> these are very similar. Then, I want to find the fundamental concepts to
> construct a library which enable to configure the options for the different
> services and send messages easily.
>
> When I say they are very similar, I refer to the fact that they all are
> asynchronous, best-effort services that offers third-party developers a
> channel to send data to apps from a cloud service in a power-efficient
> manner. The most popular are:
>
> - Google Cloud Messaging (Android)
>
> - Apple Push Notification Service (iPhone / iPad)
>
> - Microsoft Push Notification Service (Windows Phone)
>
> - BlackBerry Push Service (BlackBerry)
>
> - Windows Push Notification Services (Windows 8)
>
> - etc.
>
>
> Motivation and expected benefits
>
> I think my idea would be very useful because it will allow all Haskell
> developers to open to a new world of mobile devices and to build useful
> programs/services that interact with them.
>
> Pushing data to smartphones provides users with instant access to desired
> updates as they happen, such as news and weather, sports sc

Re: [Haskell-cafe] Map Reduce spec in Haskell

2013-04-18 Thread Kristopher Micinski
This looks right, but there is definitely a lot more to mapreduce
implementations than algebraic signatures!

It might also be considered that there are lots of people using
MapReduce technology on things other than "bare metal"
Hadoop/MapReduce, etc..  Lots of data analysts, ML people, etc.., use
Apache Pig, Hive, HBase, etc...

One thing I've really been interested in seeing is a (presumably
comonadic) interface to Apache Pig: many uses of Hadoop simply deal
with dataflow-like programming.  Having a (co?)monad where the values
represent "types" of terms in the Pig language, that produces and runs
Pig programs seems like a fun idea: I'd definitely try it out if
anyone came up with it.

But of course, don't forget about Cloud Haskell and the other related efforts!

Kris

On Thu, Apr 18, 2013 at 2:49 PM, John D. Ramsdell  wrote:
> I'm learning about the Map Reduce computation frequently used with big data.
> For the fun of it, I decided to write a very high-level spec of Map Reduce.
> Here is what I came up with.  Enjoy.
>
> John
>
>> module MapReduce where
>> import Data.List (nub)
>
> A high-level specification of Map Reduce as a Haskell program.  The
> program uses lists to represent multisets.  As multisets have no
> implied ordering, the ordering implied by lists in this specification
> should be ignored.
>
> The database is a multiset of key-value pairs.
>
>> type Key = String
>> type Value = String
>> type Datum = (Key, Value)
>> type Data = [Datum]
>
> A mapper maps a datum to a finite multiset of key-value pairs.
>
>> type Mapper = Datum -> Data
>
> A reducer takes a key and a multiset of values and produces a finite
> multiset of values.
>
>> type Reducer = (Key, [Value]) -> [Value]
>
> A step is a mapper followed by a reducer
>
>> type Step = (Mapper, Reducer)
>
> A program is a finite sequence of steps
>
>> type Program = [Step]
>
> The semantics of a program is provided by the run function.
>
>> run :: Program -> Data -> Data
>> run [] d = d
>> run (s : p) d =
>>   run p (step s d)
>
> The three parts of a step are mapping, shuffling, and reducing.
>
>> step :: Step -> Data -> Data
>> step (m, r) d =
>>   let mapped = transform m d
>>   shuffled = shuffle mapped in
>>   reduce r shuffled
>
> The first part of a step is to transform the data by applying the
> mapper to each datum and collecting the results.
>
>> transform :: Mapper -> Data -> Data
>> transform m d =
>>   [p | u <- d, p <- m u]
>
> Next, values with common keys are collected.  Keys are unique after
> shuffling.
>
>> shuffle :: Data -> [(Key, [Value])]
>> shuffle d =
>>   [(k, vs) | k <- nub (map fst d), -- nub eliminates duplicate keys
>>  let vs = [v | (k', v) <- d, k' == k]]
>
> A reducer is applied to the data associated with one key, and always
> produces data with that key.
>
>> reduce :: Reducer -> [(Key, [Value])] -> Data
>> reduce r rs =
>>   [(k, v) | (k, vs) <- rs, v <- r (k, vs)]
>
>
> ___
> 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] Compilers book in Haskell

2013-04-07 Thread Kristopher Micinski
A swapped order probably appeals to most haskellers (by contrast I
first learned ML).  The real difference is that the Haskell books will
focus on lazy languages.  If your tastes are in implementing fast lazy
languages using graph reduction then you may also be interested in
[1]: although I haven't read all of it.  I would say that the material
in Appel's books and SPJ's books is fairly disjoint, and if you're
interested in Haskell you should definitely focus on those.  (However,
Appel's book is also worth browsing if you're at a library, it can be
read fairly quickly, the main "cool concepts" are in chapter two!)

Kris

[1] 
http://wiki.clean.cs.ru.nl/Functional_Programming_and_Parallel_Graph_Rewriting

On Sun, Apr 7, 2013 at 9:00 PM, Tommy Thorn  wrote:
> You beat me to it although I'd reverse the order of your list.
>
> Also I wouldn't ignore the classic,
> http://www.amazon.com/Compilers-Principles-Techniques-Tools-Edition/dp/0321486811
> but know that it has next to nothing useful specific to FP languages,
> and certainly not lazy languages.
>
> Tommy
>
> On Apr 7, 2013, at 07:40 , Kristopher Micinski  wrote:
>
>> I disagree about the recommendation for Modern Compiler Design: I
>> found it to be a pretty good introduction to compiler technology, but
>> not functional programming with compilers, it's coverage was *very*
>> shallow.
>>
>> By contrast, I can recommend both Compiling with Continuations (the
>> "standard" text on implementing compilers in functional languages,
>> using ML as an example), and The Implementation of Functional
>> Programming Languages [2].
>>
>> This topic is covered pretty well in course material scattered
>> throughout the web, (lots of course with online pdf sets about
>> implementing functional compilers), but not in a comprehensive fashion
>> that talks about more complex aspects of compiling functional
>> languages.  Implementing Functional Langauges: a tutorial, is also
>> excellent and worth a look.
>>
>> kris
>>
>> [1] 
>> http://www.amazon.com/Compiling-Continuations-Andrew-W-Appel/dp/052103311X
>> [2] 
>> http://research.microsoft.com/en-us/um/people/simonpj/papers/slpj-book-1987/index.htm
>> [3] 
>> http://research.microsoft.com/en-us/um/people/simonpj/Papers/pj-lester-book/
>>
>> On Sun, Apr 7, 2013 at 4:36 AM, Sergey Bushnyak
>>  wrote:
>>> Books about compilers is rare artifact, in comparison to some technology
>>> books. It is uncommon to see topics on compilers for functional languages.
>>>
>>> I was surprised, when saw it in "Modern Compiler Design", which I've
>>> mentioned earlier. "Compiler design" series from Springer maybe reveal
>>> topics on FL in future as it become more popular. In new books about 1/5 of
>>> it is about FL, but very basic stuff.
>>>
>>> Кnowledge mostly lies in research papers, occasional articles like "The
>>> Glasgow Haskell Compiler"[1] in AOSA from creators, and source code :)
>>>
>>>
>>> [1] http://www.aosabook.org/en/ghc.html
>>>
>>> --
>>> Best regards,
>>> Sergey Bushnyak
>>>
>>>
>>> ___
>>> 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] Compilers book in Haskell

2013-04-07 Thread Kristopher Micinski
I disagree about the recommendation for Modern Compiler Design: I
found it to be a pretty good introduction to compiler technology, but
not functional programming with compilers, it's coverage was *very*
shallow.

By contrast, I can recommend both Compiling with Continuations (the
"standard" text on implementing compilers in functional languages,
using ML as an example), and The Implementation of Functional
Programming Languages [2].

This topic is covered pretty well in course material scattered
throughout the web, (lots of course with online pdf sets about
implementing functional compilers), but not in a comprehensive fashion
that talks about more complex aspects of compiling functional
languages.  Implementing Functional Langauges: a tutorial, is also
excellent and worth a look.

kris

[1] http://www.amazon.com/Compiling-Continuations-Andrew-W-Appel/dp/052103311X
[2] 
http://research.microsoft.com/en-us/um/people/simonpj/papers/slpj-book-1987/index.htm
[3] http://research.microsoft.com/en-us/um/people/simonpj/Papers/pj-lester-book/

On Sun, Apr 7, 2013 at 4:36 AM, Sergey Bushnyak
 wrote:
> Books about compilers is rare artifact, in comparison to some technology
> books. It is uncommon to see topics on compilers for functional languages.
>
> I was surprised, when saw it in "Modern Compiler Design", which I've
> mentioned earlier. "Compiler design" series from Springer maybe reveal
> topics on FL in future as it become more popular. In new books about 1/5 of
> it is about FL, but very basic stuff.
>
> Кnowledge mostly lies in research papers, occasional articles like "The
> Glasgow Haskell Compiler"[1] in AOSA from creators, and source code :)
>
>
> [1] http://www.aosabook.org/en/ghc.html
>
> --
> Best regards,
> Sergey Bushnyak
>
>
> ___
> 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] Optimizing Fold Expressions

2013-04-02 Thread Kristopher Micinski
On Mon, Apr 1, 2013 at 11:00 PM, Conal Elliott  wrote:
> ...
> For details, see Jeremy Gibbons's paper "Calculating functional programs".
> There are probably easier sources as well.

Apologies for the tangential chiming in: on the topic of "easier
sources" you can also look at a few other papers, e.g., Programming
with algebras (Kiebertz and Lewis). There's also a good book "The
Algebra of Programming"
(http://www.amazon.com/Algebra-Programming-Prentice-International-Computer/dp/013507245X)
that might be worth a read if you can pick it up at your local
library.

There will of course be many other good tutorials on algebra in
programming, you can probably google "categorical programming" or
terms that get you around that area :-)

Kris

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


Re: [Haskell-cafe] Open-source projects for beginning Haskell students?

2013-03-12 Thread Kristopher Micinski
The problem with all of these suggestions is that they start from no code.
 I believe Brent is looking for an *existing* project which needs
contributions.  I assume so that beginning Haskellers can learn real code
style in the middle to large, and get input from existing community members.

Kris


On Tue, Mar 12, 2013 at 1:59 PM, Vo Minh Thu  wrote:

> 2013/3/11 Brent Yorgey :
> > Hi everyone,
> >
> > I am currently teaching a half-credit introductory Haskell class for
> > undergraduates.  This is the third time I've taught it.  Both of the
> > previous times, for their final project I gave them the option of
> > contributing to an open-source project; a couple groups/individuals
> > took me up on it and I think it ended up being a modest success.
> >
> > So I'd like to do it again this time around, and am looking for
> > particular projects I can suggest to them.  Do you have an open-source
> > project with a few well-specified tasks that a relative beginner (see
> > below) could reasonably make a contribution towards in the space of
> > about four weeks? I'm aware that most tasks don't fit that profile,
> > but even complex projects usually have a few "simple-ish" tasks that
> > haven't yet been done just because "no one has gotten around to it
> > yet".
> >
> > If you have any such projects, I'd love to hear about it!  Just send
> > me a paragraph or so describing your project and explaining what
> > task(s) you could use help with --- something that I could put on the
> > course website for students to look at.
> >
> > Here are a few more details:
> >
> > * The students will be working on the projects from approximately the
> >   end of this month through the end of April.  During the next two
> >   weeks they would be contacting you to discuss the possibility of
> >   working on your project.
> >
> > * By "relative beginner" I mean someone familiar with the material
> >   listed here: http://www.cis.upenn.edu/~cis194/lectures.html and just
> >   trying to come to terms with Applicative and Monad.  They definitely
> >   do not know much if anything about optimization/profiling, GADTs,
> >   the mtl, or Haskell-programming-in-the-large.  (Although part of the
> >   point of the project is to teach them a bit about
> >   programming-in-the-(medium/large)).
> >
> > * What I would hope from you is a willingness to exchange email and/or
> >   chat with the student(s) over the course of the project, to give
> >   them a bit of guidance/mentoring.  I am certainly willing to help on
> >   that front, but of course I probably don't know much about your
> >   particular project.
>
> Maybe it is a too small project (and not a contribution to an existing
> project), but a Haskell wrapper around PostgreSQL setproctitle code
> would be nice (something similar exists in the Python world).
>
> Otherwise I have began some "infrastructure" projects on GitHub that
> are all pretty simple but could be damn useful: curved is meant to be
> a drop-in-replacement for graphite (it is almost the case), sentry is
> a process-monitoring tool, humming is a job queue on top of
> PostgreSQL, hlinode is a binding to the Linode API, ... They all have
> in common that they are small, self-contained, and quite often just
> massaging around rawSystem calls, database "execute" calls, or
> GET/POST calls.
>
> Thu
>
> ___
> 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] Mobile app development?

2013-01-23 Thread Kristopher Micinski
For reference, the only components provided by the Android platform
(listed on the Android website, and what I found digging through the
provided NDK) are:

libc (C library) headers
libm (math library) headers
JNI interface headers
libz (Zlib compression) headers
liblog (Android logging) header
OpenGL ES 1.1 and OpenGL ES 2.0 (3D graphics libraries) headers
libjnigraphics (Pixel buffer access) header (for Android 2.2 and above).
A Minimal set of headers for C++ support
OpenSL ES native audio libraries
Android native application APIS

Having these things is a far cry from being able to use any of the
typical Android facilities from native code: you can't even implement
GUI normally.

The one project I've seen which attempts to generate stubs for easy
use by native code is:
http://code.google.com/p/cle-for-android/

I'm not sure of the current status, but the last I checked it was
still a bit premature.

Kris

On Wed, Jan 23, 2013 at 1:48 PM, Kristopher Micinski
 wrote:
> In what way are they exposed for use?  I certainly haven't seen any
> API which lets you touch any of the standard GUI utilities without
> writing JNI wrappers that communicate to the Java based UI elements.
>
> As far as I know there is no way to use the actual Android API: you
> have to write a wrapper through the JNI to use the Java version.
>
> Can you point to a native library which allows you to hook in to the
> Android SDK?  I'd be very interested in seeing it.
>
> Kris
>
>
> On Wed, Jan 23, 2013 at 10:54 AM, Brandon Allbery  wrote:
>> On Tue, Jan 22, 2013 at 8:37 PM, Kristopher Micinski
>>  wrote:
>>>
>>> By the way, the Android APIs aren't really meant to be used by native
>>> code: the only real use for native code in Android is GPU code and
>>> math code (think games and DSP-type programs).
>>
>>
>> They may not be "meant" to be in some sense, but from Android 2.3 on they
>> are exposed for such use --- and I believe language porting like this is one
>> of the intended uses.
>>
>>
>> --
>> brandon s allbery kf8nh   sine nomine associates
>> allber...@gmail.com  ballb...@sinenomine.net
>> unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net

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


Re: [Haskell-cafe] Mobile app development?

2013-01-23 Thread Kristopher Micinski
In what way are they exposed for use?  I certainly haven't seen any
API which lets you touch any of the standard GUI utilities without
writing JNI wrappers that communicate to the Java based UI elements.

As far as I know there is no way to use the actual Android API: you
have to write a wrapper through the JNI to use the Java version.

Can you point to a native library which allows you to hook in to the
Android SDK?  I'd be very interested in seeing it.

Kris


On Wed, Jan 23, 2013 at 10:54 AM, Brandon Allbery  wrote:
> On Tue, Jan 22, 2013 at 8:37 PM, Kristopher Micinski
>  wrote:
>>
>> By the way, the Android APIs aren't really meant to be used by native
>> code: the only real use for native code in Android is GPU code and
>> math code (think games and DSP-type programs).
>
>
> They may not be "meant" to be in some sense, but from Android 2.3 on they
> are exposed for such use --- and I believe language porting like this is one
> of the intended uses.
>
>
> --
> brandon s allbery kf8nh   sine nomine associates
> allber...@gmail.com  ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net

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


Re: [Haskell-cafe] Mobile app development?

2013-01-22 Thread Kristopher Micinski
I don't believe that was really the point of the C compiler, and I'd
suspect you'd have a hard time with the runtime.

By the way, the Android APIs aren't really meant to be used by native
code: the only real use for native code in Android is GPU code and
math code (think games and DSP-type programs).

Wrapping the libraries for use by native code is *possible*, but
getting it right will be very hard: it's not like you're going to have
a simple C library which lets you touch Android's `View` hierarchy,
for example.

On top of that, you'd also want to have a "true" functional interface
to Android's API: you probably don't want to just use the Java API
verbatim.

What was your implementation plan for doing this, should you get a
runtime up for Haskell code?  I'd guess that you can pretty easily get
a Haskell program to *run* on the device from the device's command
line.  But I'd also guess that getting it to play well with Android
will be a *lot* of work.

I don't really have the time or GHC internals experience to do this,
but if someone wanted help on it, I'd be interested.

The web interface idea is okay, but obviously you're punting on speed
if you do that.  You might look into the Boot2Gecko project at
Mozilla, it has similar aspirations.

Kris

On Tue, Jan 22, 2013 at 2:40 PM, Andrew Pennebaker
 wrote:
> Can we un-deprecate GHC's ability to compile to C code? C may be the best
> option to bridge to mobile, as Android, iOS, and Windows RT do support C/C++
> apps.
>
> On Jan 22, 2013 2:14 PM, "Dan Choi"  wrote:
>>
>>
>> What about the option of using Haskell's Parsec or AttoParsec to implement
>> a Haskell-ish language that compiles down not to machine code but to
>> Objective C or Android Java? Like how CoffeeScript compiles down to
>> JavaScript.
>>
>>
>>
>> On Saturday, January 19, 2013 1:58:03 PM UTC-5, Casey Hawthorne wrote:
>>>
>>> You would need native compilers for all the platforms and/or virtual
>>> machine technology.
>>>
>>> Might be easier to have the browser connect to a Haskell app.
>>>
>>>
>>> On Sat, Jan 19, 2013 at 10:42 AM, Andrew Pennebaker
>>>  wrote:
>>> > There are currently very few options, especially free and open source
>>> > options, when it comes to developing cross-platform mobile
>>> > applications.
>>> > It's basically web apps with JavaScript, or C++. If Haskell supported
>>> > app
>>> > development on Android, iOS, and Windows RT, that alone would bring in
>>> > more
>>> > developers.
>>> >
>>> > Similarly, there are very few languages for mobile development that
>>> > take
>>> > advantage of multiple cores and multiple CPUs. Haskell's `parmap` is an
>>> > amazing selling point. Can we please prioritize mobile support? I'd
>>> > much
>>> > rather write everything in ML than PhoneGap.
>>> >
>>> > --
>>> > Cheers,
>>> >
>>> > Andrew Pennebaker
>>> > www.yellosoft.us
>>> >
>>> > ___
>>> > Haskell-Cafe mailing list
>>> > haskel...@haskell.org
>>> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>>> >
>>>
>>>
>>>
>>> --
>>> --
>>> Regards,
>>> KC
>>>
>>> ___
>>> Haskell-Cafe mailing list
>>> haskel...@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] GHC for mobile devices?

2012-11-11 Thread Kristopher Micinski
Yes, and the Android NDK allows you to write arbitrary C code, it's
just a slightly less than pleasant interface with the SDK :-(.

Perhaps it's easier to do this in iOS as it's all objective C rather
than a vm with a runtime system.  Also not sure what the status of
porting the runtime system to ios would be.

kris

On Sat, Nov 10, 2012 at 9:03 PM, Andrew Pennebaker
 wrote:
> ASM for iOS is possible, so GHC mobile should be possible.
>
> www.shervinemami.info/armAssembly.html#howto
>
> On Nov 10, 2012 5:59 PM, "Andrew Pennebaker" 
> wrote:
>>
>> I've tried porting GHC to Haiku OS, a Unix-like desktop OS, but the state
>> of the GHC build system is fairly confusing. The build scripts contain a
>> Perl script with a bad shebang, and you can't build GHC without already
>> having a working older version.
>>
>> If someone can point me to the most recent GHC code that doesn't need
>> itself to compile, I can work on a Haiku version as practice. I really want
>> GHC for every possible system.
>>
>> On Nov 10, 2012 5:49 PM, "Kristopher Micinski" 
>> wrote:
>>>
>>> On Sat, Nov 10, 2012 at 3:50 PM, Casey Basichis 
>>> wrote:
>>> > Hi Kris,
>>> >
>>> > No offense taken, it was an argument that works to shut down
>>> > constructive
>>> > discussion of how to get Haskell running on mobile, a task which has
>>> > perplexed me for several long days.  I agree most apps are pretty
>>> > terrible,
>>> > at least on iOS though, despite the percentages being wildly off there
>>> > are
>>> > still a few hundred apps that are very well done and thoughtful, none
>>> > of
>>> > them using Haskell I'm sure.
>>> >
>>>
>>> Yup!  Most of the time apps are merely "translated" versions of rails
>>> frontends.  (For better or for worse, I assume that if we were to port
>>> haskell to work with Android really it would be mostly to appease my
>>> purity.)
>>>
>>> > I'm looking to pass Haskell lists of musical data and return processed
>>> > musical ideas from it (not audio, not realtime).  I was also planning
>>> > on
>>> > handling a database within Haskell as the information contained would
>>> > be
>>> > used by the music processing and from what I have read Haskell
>>> > interfaces to
>>> > SQL far more readily than with a C++ orm type solution.  I was planning
>>> > on
>>> > working with Haskells Euterpea as base to build my ideas off of, my I
>>> > might
>>> > end up rolling my own similar library as my aims are a bit different
>>> > than
>>> > theirs.
>>> >
>>>
>>> I'm not sure I understand completely, but I agree this isn't a bad idea.
>>>
>>> > Everything else would be C++, including the interface, audio and dsp
>>> > processing etc.   I already have the C++ stuff running on my phone.  I
>>> > have
>>> > read about the difficulty of getting Haskell working in real world
>>> > scenarios, but as far as I understand my plans for it are fairly well
>>> > suited
>>> > to it.
>>> >
>>>
>>> I don't disagree!
>>>
>>> > Since much of the documentation online about Haskell seems to be out of
>>> > date, its tough to get a general feel for whats working.  I see people
>>> > mention that cross-compilation was finished a while back which should
>>> > allow
>>> > for targeting arm but nothing concrete and the website gives
>>> > conflicting
>>> > info.  I've also considered using GHC to generate C to paste into the
>>> > project but it seems there have been and may be more integrated ways to
>>> > get
>>> > it running.
>>>
>>> I am venturing into my embarrassing lack of knowledge about GHC
>>> internals here, but how easily would the run time system work on
>>> Android..?  I had assumed a large part of the effort into getting
>>> OCaml to work on iPhone went into the runtime system, no?
>>>
>>> If you're (Andrew or anyone) still interested in pursuing this I would
>>> be interested in helping out, I have some Android internals knowledge
>>> and would be glad to lend a hand.
>>>
>>> One major thing that seems to be necessary is congealing all the
>>> (mis/outdated)information into the wiki article on haskell.org.
>>>
>>> kris
>
>
> ___
> 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] GHC for mobile devices?

2012-11-10 Thread Kristopher Micinski
On Sat, Nov 10, 2012 at 3:50 PM, Casey Basichis  wrote:
> Hi Kris,
>
> No offense taken, it was an argument that works to shut down constructive
> discussion of how to get Haskell running on mobile, a task which has
> perplexed me for several long days.  I agree most apps are pretty terrible,
> at least on iOS though, despite the percentages being wildly off there are
> still a few hundred apps that are very well done and thoughtful, none of
> them using Haskell I'm sure.
>

Yup!  Most of the time apps are merely "translated" versions of rails
frontends.  (For better or for worse, I assume that if we were to port
haskell to work with Android really it would be mostly to appease my
purity.)

> I'm looking to pass Haskell lists of musical data and return processed
> musical ideas from it (not audio, not realtime).  I was also planning on
> handling a database within Haskell as the information contained would be
> used by the music processing and from what I have read Haskell interfaces to
> SQL far more readily than with a C++ orm type solution.  I was planning on
> working with Haskells Euterpea as base to build my ideas off of, my I might
> end up rolling my own similar library as my aims are a bit different than
> theirs.
>

I'm not sure I understand completely, but I agree this isn't a bad idea.

> Everything else would be C++, including the interface, audio and dsp
> processing etc.   I already have the C++ stuff running on my phone.  I have
> read about the difficulty of getting Haskell working in real world
> scenarios, but as far as I understand my plans for it are fairly well suited
> to it.
>

I don't disagree!

> Since much of the documentation online about Haskell seems to be out of
> date, its tough to get a general feel for whats working.  I see people
> mention that cross-compilation was finished a while back which should allow
> for targeting arm but nothing concrete and the website gives conflicting
> info.  I've also considered using GHC to generate C to paste into the
> project but it seems there have been and may be more integrated ways to get
> it running.

I am venturing into my embarrassing lack of knowledge about GHC
internals here, but how easily would the run time system work on
Android..?  I had assumed a large part of the effort into getting
OCaml to work on iPhone went into the runtime system, no?

If you're (Andrew or anyone) still interested in pursuing this I would
be interested in helping out, I have some Android internals knowledge
and would be glad to lend a hand.

One major thing that seems to be necessary is congealing all the
(mis/outdated)information into the wiki article on haskell.org.

kris

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


Re: [Haskell-cafe] GHC for mobile devices?

2012-11-10 Thread Kristopher Micinski
On Sat, Nov 10, 2012 at 9:21 AM, Casey Basichis  wrote:
> As for you notion of "hard truth," and "dumb apps acting as web front ends"
> its pretty blase to assume that anyone interested in this thread will share
> that perspective in terms of their own goals on these platforms.  I compose
> professionally on my phone, its certainly not a toy for my purposes.  I also
> have no interest whatsoever in getting Cocoa commands into Haskell. I just
> want a functional way of working with data.
>

I didn't perceive my comment would be taken as insulting by people,
but I apologize if it was!  It is based on quite detailed study of why
people write apps that I've been working on for the past year or so.
The vast majority of apps are thin wrappers around REST services.  I
didn't mean to imply that this is what you would be using it for here,
but rather to give an explanation as to why Haskell may have not shown
up.

I only meant that, at some level, you are going to need to fit into
the platform, you can't deny this: for the case of Android you *have*
to hook into the lifecycle somewhere, because that's how the system
runs your app. You also probably want a GUI (maybe *you* don't, but
I'd wager most people *do*).

In any case, you can get good programming done without much platform
assistance using things like the NDK, some projects manage to do this:
mostly projects with gobs of C++ code ported from desktop to Android
where they need minimal Java sections because of fast production
cycles.

> I would greatly prefer to go the Haskell route, but  have been considering
> OCaml as well as they seem to have an active and enthused interest in iOS.
> I would love a bit of perspective on whether OCaml would be worth pursing in
> the long run for the short term benefit of having a more mature mobile
> implementation.'
>

What do you want to do with it?  From what I can tell about all the
OCaml projects I've seen, they still mostly suffer from the problems
of having a limited interface to the Android system proper.

(I'm not saying that makes them bad, just harder to use to write real apps..)

kris

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


Re: [Haskell-cafe] GHC for mobile devices?

2012-11-10 Thread Kristopher Micinski
Yes, I've seen some of the work done on this and I think he's also
looked into OCaml on Android.

To be completely honest it's not really the language that's such the
barrier: the hard truth is that any Android app doing anything of
interest is necessarily going to be using the Android framework.
Android programming (at least, presubaly iOS too) is not a lot of
advanced construction, it's mostly dumb apps acting as web frontends,
I'd posit that this is probably why people have been mostly content
with the Android API for so long anyway.

So the main barrier is being able to interface with the Java side of
things (obviously) in a way that doesn't completely kill perf either
(this sounds nontrivial...).  Then you need to give a sane
reimplementation of the Android API within Haskell.

kris

On Sat, Nov 10, 2012 at 12:59 AM, Mike Ledger  wrote:
> I would be so very happy to be able to program Haskell Android programs. I
> think the steps we'd need are to 1. Port GHC to ARM (done already?) and 2.
> Create a JVM calling convention for GHC (using JNI? I have no idea). Short
> of actually making a new calling convention for the JVM, maybe we could use
> the JNI to create a thin C wrapper that has the code we want to import
> normally.
>
> Unfortunately I have no idea of where to start and very little experience
> with Android other than firing up Eclipse, playing around with simple
> applications and being very dissatisfied.
>
>
> On Sat, Nov 10, 2012 at 4:32 PM, Andrew Pennebaker
>  wrote:
>>
>> Awesome! Jeffrey Scofield has ported OCaml to iOS, so there's also
>> experience there.
>>
>>
>> On Fri, Nov 9, 2012 at 11:46 PM, Kristopher Micinski
>>  wrote:
>>>
>>> If you have interest in doing this, I have quite a bit of experience
>>> in Android hacking at the system level and above and would be glad to
>>> talk about what might need to happen.  (Though I don't know the GHC
>>> internals / toolchain so well.)
>>>
>>> One potential choice is Scala, though from my limited experience
>>> that's a very rough imitation of the uses for Haskell.  (Though,
>>> obviously it works mostly out of the box because of the JVM compiler
>>> target..)
>>>
>>> http://www.haskell.org/haskellwiki/Android
>>>
>>> I've been writing up some thoughts on the Android activity lifecycle
>>> already interpreted with respect to FP, apps are quite functional
>>> already for a variety of reasons.
>>>
>>> kris
>>>
>>> On Fri, Nov 9, 2012 at 8:51 PM, Andrew Pennebaker
>>>  wrote:
>>> > I'd love to use Haskell directly for making mobiles apps. How can we
>>> > make
>>> > this happen, porting GHC to Android, iOS, and Windows Phone?
>>> >
>>> > --
>>> > Cheers,
>>> >
>>> > Andrew Pennebaker
>>> > www.yellosoft.us
>>> >
>>> > ___
>>> > Haskell-Cafe mailing list
>>> > Haskell-Cafe@haskell.org
>>> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>>> >
>>
>>
>> --
>> Cheers,
>>
>> Andrew Pennebaker
>> www.yellosoft.us
>>
>>
>> ___
>> 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] GHC for mobile devices?

2012-11-09 Thread Kristopher Micinski
If you have interest in doing this, I have quite a bit of experience
in Android hacking at the system level and above and would be glad to
talk about what might need to happen.  (Though I don't know the GHC
internals / toolchain so well.)

One potential choice is Scala, though from my limited experience
that's a very rough imitation of the uses for Haskell.  (Though,
obviously it works mostly out of the box because of the JVM compiler
target..)

http://www.haskell.org/haskellwiki/Android

I've been writing up some thoughts on the Android activity lifecycle
already interpreted with respect to FP, apps are quite functional
already for a variety of reasons.

kris

On Fri, Nov 9, 2012 at 8:51 PM, Andrew Pennebaker
 wrote:
> I'd love to use Haskell directly for making mobiles apps. How can we make
> this happen, porting GHC to Android, iOS, and Windows Phone?
>
> --
> Cheers,
>
> Andrew Pennebaker
> www.yellosoft.us
>
> ___
> 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] Empirically comparing strict vs. lazy evaluation

2012-10-29 Thread Kristopher Micinski
Hello Haskellers!

I wonder if you know of benchmarks that attempt to compare,
empirically, lazy vs. eager evaluation.  Pointers to papers and/or
code would be most appreciated.

Our group (at UMD) is working on a paper that develops some technology
for lazy programs, and we would like to choose benchmarks for
evaluating it that span the gamut of computations that perform well
when done lazily, vs. those that do not perform as well when evaluated
lazily. Then we want to look at the best case and worst case for our
technology WRT laziness, and see how it stacks up.

Thanks in advance for any ideas you have!

Kris Micinski

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


Re: [Haskell-cafe] Teaching Haskell @ MOOCs like Coursera or Udacity

2012-10-25 Thread Kristopher Micinski
On Thu, Oct 25, 2012 at 4:57 PM, Gregg Lebovitz  wrote:
> I am trying to get a learning center started in the Haskell community. As
> pointed out below, MOOCs are hard to put together, however training and
> videos straight forward. There is a lot of teaching material available in
> the community. It is a matter of finding, organizing and curating it.
>

At the same time the Haskell wiki and Oleg's site taken together
constitute a good amount of learning material in a semi organized
fashion.  These aren't replacements or implementations of your idea
but they come pretty close (to the point that I could spend quite a
while on the combinations of those and still feel unfinished..).  I
think the Haskell wikibook also does a good amount to address further
concepts in Haskell.  There have been tons of great FP books written
over the years, many of which aren't even frequently mentioned by
people, but at the same time nothing helps like actually using it in
your own personal projects, I haven't seen so much elaboration on
*this* point.  (For example, doing this would probably mean talking
about a set of parser combinators, some script-y haskell libraries, a
web framework, etc...)

Interesting quote:
After all, if we didn’t need teachers, then we could earn our
undergraduate degrees by spending four years in the library.

Is this not what most people do?  I know that was certainly my experience :-).

One problem with Haskell: the language moves fast.  "Core Haskell"
isn't all that hard, but if you open any real Haskell project, it's
going to use advanced (sometimes unstable) extensions that aren't
going to be in your book or web guide, making some people feel stuck.
These concepts aren't necessarily difficult, but if you actually want
to use Haskell you need to face the more popular language extensions.
Off the top of my head, existential types, arrows, higher kinds, all
stick out to me as being things you see in most code, along with (of
course) monad transformer stacks that will scare off newcomers and
aren't explained in any cohesive context other than the Haskell
wiki...

kris

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


Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius

2012-10-14 Thread Kristopher Micinski
On Sun, Oct 14, 2012 at 1:37 PM, Bartosz Milewski
 wrote:
> I'm afraid this kind of 5-minute talk makes sense only if you already know a
> lot about monads or are a computer scientist; not if you're a programmer who
> wants to learn a new language. For instance, this statement starts making
> sense only if you've seen a lot of examples of monads (maybe even read Moggi
> and Wadler) and want to understand the big picture.
>

fwiw I never intended it to be a discussion to people who want to
learn Haskell, my target audience is people who know Haskell basics,
some amount of computer science and math background (typical of ML
converts, for example).

> "... when Haskell programmers want to perform a side effect, they explicitly
> construct a description of the side effecting computation as a value."
>

I really disagree that reading Moggi's paper is a prerequisite to
understanding that statement, I would have understood that (although
without example) long before having read Moggi's paper, and I still
don't understand all of it!

> And even then, what does it mean to "construct a description of the side
> effecting computation as a value" for the Maybe monad? An IO action or a
> State Monad action indeed are values that describe computations, but what
> computation does (Just 1) describe? It's the simple monads that are tricky
> to explain (I've seen a discussion to that effect in this forum and I
> wholeheartedly agree).
>

Agreed, I think the problem here is using Maybe as an example.  The
problem is that monads (as all things in category theory) are these
very general things, to explain them in their full generality is
fundamentally at odds with most peoples' (certainly *my*)
understanding of learning individual examples and generalizing.  While
monads are typically used to structure computation in this way
(building a description of a side effect as a value which is elided in
the bind) they are in reality simply just some monoids in the right
category, but the Maybe description doesn't jibe as well with the
previous explanation, which motivates the need for monads more.  (The
fact you can do this with Maybe is certainly helpful, but people don't
see having to write chains of destructors as as large a barrier to
using Haskell as not being able to use IO, for example..)

kris

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


Re: [Haskell-cafe] ANNOUNCE: luachunk-0.1

2012-10-10 Thread Kristopher Micinski
On Wed, Oct 10, 2012 at 6:48 AM, Anupam Jain  wrote:
> I used the excellent "A No-Frills Introduction to Lua 5.1 VM
> Instructions" 
> (http://scholar.google.com/scholar?cluster=14039839166840129336).
> Highly recommended to get a quick overview of the entire bytecode format.
>

FYI this is we hand out to our students as well,!,

kris

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


Re: [Haskell-cafe] ANNOUNCE: luachunk-0.1

2012-10-07 Thread Kristopher Micinski
Oh, this is nice, we have our undergrads implement a compiler to Lua
bytecode as part of their term projects, and currently use a homebrew
OCaml package.  This seems to be pretty complete, however, and it
would be interesting for me to reimplement some stuff with this..

Unfortunately the Lua bytecode isn't really documented or intended to
be generated, meaning that you essentially have to reverse engineer
it.  (Maybe not "unfortunately;" it's not meant to be used like that,
but unfortunately for people looking to find projects to assign
people...)

kris

On Fri, Oct 5, 2012 at 9:51 AM, Anupam Jain  wrote:
> Hi all,
>
> I just released luachunk-0.1 on Hackage
> (http://github.com/ajnsit/luachunk). Luachunk is a small library to
> read and write Lua 5.1 bytecode chunks. It is modeled after
> ChunkSpy.lua (http://luaforge.net/projects/chunkspy/) though the code
> is written from scratch. A pretty listing printer for lua bytecode is
> in the works.
>
> I used LuaChunk in a project to generate Lua bytecode via a DSL, and
> then interpret it with HsLua. I hope to release the DSL itself
> sometime in the future.
>
> -- Anupam
>
> ___
> 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] Which advanced Haskell topics interest you

2012-10-04 Thread Kristopher Micinski
On Thu, Oct 4, 2012 at 1:21 PM, Stephen Tetley  wrote:
> On 4 October 2012 18:04, Kim-Ee Yeoh  wrote:
>> Something to consider is that it's not so much whether the material is
>> basic, advanced, or intermediate; it's that the way it's being presented is
>> boring and ineffective.
>
> I'd suggest there is enough range in the Haskell books now available,
> that for most tastes, there's a beginners to intermediate book already
> a given learner wouldn't consider boring. Of course different learners
> will like different ones...
>
> As for an advanced book, maybe limiting the subject to one domain
> ("concurrency" / "DSLs for graphics" / pick a favourite ...) might
> make a better book than one targeting a mix of advanced topics.
>

Another problem is that the topics in these domains don't simply deal
with Haskell, they deal with real computer science that is not to be
understated.

Concurrency for Haskell involves tackling the real implementation
issues inherent in making things work, but also a good taste of
semantics, and actual concurrency.  If you're approaching this from an
outsider's perspective (never taken a class in concurrency, never
heard of process algebra, etc..) the topic will be more difficult than
if you're "in the know" and want a survey of topics as they are
implemented in Haskell.

As far as "functional data structures" go, we already have an
excellent book, though it of course could use updating, along with
real world Haskell like treatment, but the core "thinking" is there.

kris

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


Re: [Haskell-cafe] Monads

2012-09-30 Thread Kristopher Micinski
On Sun, Sep 30, 2012 at 6:33 PM, Jake McArthur  wrote:
>
> On Sep 30, 2012 10:56 AM, "Albert Y. C. Lai"  wrote:
>>
>> On 12-09-29 09:57 PM, Vasili I. Galchin wrote:
>>>
>>>  I would an examples of monads that are pure, i.e. no
>>> side-effects.
>>
>>
>> What does "side effect" mean, to you? Definition?
>
> When discussing monads, at least, a side effect is an effect that is
> triggered by merely evaluating an expression. A monad is an interface that
> decouples effects from evaluation.
>

Ohh, I like that quote.., that's another good one..

kris

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


Re: [Haskell-cafe] Monads

2012-09-29 Thread Kristopher Micinski
You have fallen into the misconception that monads are impure, they are not.

Many monad tutorials begin (erroneously) with the lines "monads allow
you to do impure programming in Haskell."

This is false, monads are pure, it's IO that's impure, not the monadic
programming style.  Monads let you *emulate* an impure style in pure
code, but it's nothing more than this: an emulation.

So in summary you can take any monad you want, and it will be pure,
however it's underlying implementation may not be (such is the case
with IO, for example).  Consider any of:
  -- State,
  -- List,
  -- Cont,
  -- ... literally any monad, some may be more "obviously pure" than
others, but hey, people say that about me all the time.

kris

On Sat, Sep 29, 2012 at 9:57 PM, Vasili I. Galchin  wrote:
> Hello,
>
> I would an examples of monads that are pure, i.e. no side-effects.
>
> Thank you,
>
> Vasili
>
>
> ___
> 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] Fmark markup language

2012-09-17 Thread Kristopher Micinski
Jose,

So I'm interested to hear you opinion on this as well...

I use Pandoc with Markdown through Hakyll, which allows you to do a
fair amount of cute things that are just really helpful for
maintaining a blog (for example..).  But I didn't get this from
reading your github readme: what makes your markup language special?
Could you give an example of how the language is more expressive than
(say) markdown processed through Pandoc (I only mention because it
lets you process LaTeX, very helpful, right...) or something
comparable?

kris

On Mon, Sep 17, 2012 at 11:09 PM, José Lopes  wrote:
> Hello everyone,
>
> I just wanted to share a package I created called Fmark, now available
> on HackageDB.
>
> Feedback both on the project and on the code is greatly appreciated :)
>
> Fmark (Friendly Markup) is a very simple markup language without
> syntax and simple but sophisticated document styling, capable of
> producing PDF and XML files.
>
> The key philosophy behind this markup language is to eliminate the
> strange syntactic characters seen in most markup languages, but
> at the same time try to maintain a high level of expressiveness, using
> only document reconstruction.
>
> Check it out
> http://hackage.haskell.org/package/fmark
> https://github.com/jabolopes/fmark
>
> Best regards,
> José
>
> --
> José António Branquinho de Oliveira Lopes
> 58612 - MEIC-A
> Instituto Superior Técnico (IST), Universidade Técnica de Lisboa (UTL)
> jose.lo...@ist.utl.pt
>
>
> ___
> 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] Tutorial: Haskell for the Evil Genius

2012-09-16 Thread Kristopher Micinski
Agreed.  Great.  I still contend that it would be cool to get this to
be a real thing at something like the Haskell workshop, I think
hearing the different perspectives would be an interesting insight
into the many different ways to explain monads.  But I suppose the way
to start would be to put up a webpage for collecting them..

kris

On Sun, Sep 16, 2012 at 3:55 PM, Conal Elliott  wrote:
> Hi Tillmann. Wow. Lovely and spot on! And I almost never hear monad
> explanations without wincing. Thanks for sharing.  -- Conal
>
> On Sun, Sep 16, 2012 at 7:48 AM, Tillmann Rendel
>  wrote:
>>
>> Hi,
>>
>>
>> Kristopher Micinski wrote:
>>>
>>> Everyone in the Haskell cafe probably has a secret dream to give the
>>> best "five minute monad talk."
>>
>>
>> (1) Most programming languages support side effects. There are different
>> kinds of side effects such as accessing mutable variables, reading files,
>> running in parallel, raising exceptions, nondeterministically returning more
>> than one answer, and many more. Most languages have some of these effects
>> built into their semantics, and do not support the others at all.
>>
>> (2) Haskell is pure, so it doesn't support any side effects. Instead, when
>> Haskell programmers want to perform a side effect, they explicitly construct
>> a description of the side effecting computation as a value. For every group
>> of related side effects, there is a Haskell type that describes computations
>> that can have that group of side effects.
>>
>> (3) Some of these types are built in, such as IO for accessing the world
>> outside the processor and ST for accessing local mutable variables. Other
>> such types are defined in Haskell libraries, such as for computations that
>> can fail and for computations that can return multiple answers. Application
>> programmers often define their own types for the side effects they need to
>> describe, tailoring the language to their needs.
>>
>> (4) All computation types have a common interface for operations that are
>> independent of the exact side effects performed. Some functions work with
>> arbitrary computations, just using this interface. For example, we can
>> compose a computation with itself in order to run it twice. Such generic
>> operations are highly reusable.
>>
>> (5) The common interface for constructing computations is called "Monad".
>> It is inspired by the mathematical theory that some computer scientists use
>> when they describe what exactly the semantics of a programming language with
>> side effects is. So most other languages support some monad natively without
>> the programmer ever noticing, whereas Haskell programmers can choose (and
>> even implement) exactly the monads they want. This makes Haskell a very good
>> language for side effecting computation.
>>
>>   Tillmann
>>
>>
>> ___
>> 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] Tutorial: Haskell for the Evil Genius

2012-09-16 Thread Kristopher Micinski
Agreed.  Great.  I still contend that it would be cool to get this to
be a real thing at something like the Haskell workshop, I think
hearing the different perspectives would be an interesting insight
into the many different ways to explain monads.  But I suppose the way
to start would be to put up a webpage for collecting them..

kris

On Sun, Sep 16, 2012 at 3:55 PM, Conal Elliott  wrote:
> Hi Tillmann. Wow. Lovely and spot on! And I almost never hear monad
> explanations without wincing. Thanks for sharing.  -- Conal
>
> On Sun, Sep 16, 2012 at 7:48 AM, Tillmann Rendel
>  wrote:
>>
>> Hi,
>>
>>
>> Kristopher Micinski wrote:
>>>
>>> Everyone in the Haskell cafe probably has a secret dream to give the
>>> best "five minute monad talk."
>>
>>
>> (1) Most programming languages support side effects. There are different
>> kinds of side effects such as accessing mutable variables, reading files,
>> running in parallel, raising exceptions, nondeterministically returning more
>> than one answer, and many more. Most languages have some of these effects
>> built into their semantics, and do not support the others at all.
>>
>> (2) Haskell is pure, so it doesn't support any side effects. Instead, when
>> Haskell programmers want to perform a side effect, they explicitly construct
>> a description of the side effecting computation as a value. For every group
>> of related side effects, there is a Haskell type that describes computations
>> that can have that group of side effects.
>>
>> (3) Some of these types are built in, such as IO for accessing the world
>> outside the processor and ST for accessing local mutable variables. Other
>> such types are defined in Haskell libraries, such as for computations that
>> can fail and for computations that can return multiple answers. Application
>> programmers often define their own types for the side effects they need to
>> describe, tailoring the language to their needs.
>>
>> (4) All computation types have a common interface for operations that are
>> independent of the exact side effects performed. Some functions work with
>> arbitrary computations, just using this interface. For example, we can
>> compose a computation with itself in order to run it twice. Such generic
>> operations are highly reusable.
>>
>> (5) The common interface for constructing computations is called "Monad".
>> It is inspired by the mathematical theory that some computer scientists use
>> when they describe what exactly the semantics of a programming language with
>> side effects is. So most other languages support some monad natively without
>> the programmer ever noticing, whereas Haskell programmers can choose (and
>> even implement) exactly the monads they want. This makes Haskell a very good
>> language for side effecting computation.
>>
>>   Tillmann
>>
>>
>> ___
>> 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] Tutorial: Haskell for the Evil Genius

2012-09-15 Thread Kristopher Micinski
On Fri, Sep 14, 2012 at 10:08 PM, Joel Burget  wrote:
> [snip]
>
> Also, Maybe and Either are not "implemented as monads". They are defined
> using `data` like you suggest:
>
> data Maybe a = Nothing | Just a
> data Either a b = Left a | Right b
>

That's not my point, or my objection.  My objection is to people who
present monads showing examples that begin with Maybe or Either, or
these 'trivial monads,' types onto which you can strip monadic
behavior fairly simply.  I'm not saying they're bad as monads, or
useless, but I think the step from Maybe as a datatype to using it as
a monad is great enough that explaining monads by way of introducing
them with Maybe as an example is sort of confusing because it
trivializes what's actually going on.

I'm honestly not sure what you mean by Maybe or Either being
"implemented as monads," versus others.  Monad is just a type class,
there's always an underlying type.  Perhaps you mean that people
actually *care* about things in Maybe outside of it being used as a
monad, versus other things where you don't touch the underlying type.

This isn't intended to start an argument, however, and I'd prefer not
to argue over methodology, I just wanted to throw out there that if
you say "monads, think about maybe, and add some stuff, then that's it
is, what's all the fuss about!?"  I think the hard part for people
understanding monads isn't the definition of monads, but rather that
you are forced to really tackle higher order behavior in a very direct
way.  (For example, say you're new to Haskell, you probably don't know
about CPS, and you read about Cont in a monad tutorial.  Is it the
monad that makes it hard?  No, it's probably the concept of CPS.)

kris

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


Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius

2012-09-15 Thread Kristopher Micinski
On Fri, Sep 14, 2012 at 10:13 PM, Andrew Pennebaker
 wrote:
>> Challenge: get someone to have a competition at one of the conferences
>> where students all give their
>> best "five minute monad talk" and try to find the most comprehensible one!
>
>
> Challenge accepted.
>

Great!  Maybe I'll try to write up a post on this challenge and put it
on my blog, and try to solicit responses from others too, perhaps
putting up a wiki page somewhere where people can post their attempts!

(By the way, I consider this hard, I'm not touting myself as having a
good solution for this, I'm genuinely interested in others'
responses!)

kris

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


Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius

2012-09-14 Thread Kristopher Micinski
On Fri, Sep 14, 2012 at 8:23 PM, Andrew Pennebaker
 wrote:
> [snip..]
> Does anyone know of a brief introductory Haskell tutorial that engages
> monads? LYAH covers monads, but it does so after a few chapters of simpler,
> pure function Haskell coding. I know of some brief tutorials for monads that
> explain them in a variety of creative ways, but they all assume the reader
> is at least somewhat familiar with Haskell.

My opinion: you are walking down the potentially disastrous road of
trying to introduce monads in as small a tutorial as yours.  If the
person reading the tutorial is *indeed* an evil genius, I'd at least
start by showing an example of a monad that wasn't a disingenuous
presentation of their full capabilities (I'm taking a long cold stare
at  the people who write tutorials that say "hey, Maybe is a monad,
and Maybe is simple, so monads a pretty simple too!"), like the Cont
monad.  But, you say, "hell, Cont has quite a complex set of things
going on!"  And I say, yes, it's sufficiently complicated to force
people to work out the underlying details.

(As a side note, I've had an itching feeling to introduce monads to
students via having them write an interpreter and presenting it by
proxy of state based semantics in something of the spirit of Imp.)

Monads are a complex subject, not overly complex, I would say "they
let you chain things together and hide behavior under the rug," but
even this isn't helpful to someone to hasn't seen them before.  So my
argument is that if you introduce monads, you do so with a great
example that demonstrates a nontrivial monad (State or Cont, *not*
Maybe or IO).  This is a case where forcing people to work out the
math is imperative (hehe, get it, it's a pun..), programmers' natural
tendency when they see IO examples is to say "oh hey, I'll just copy
that pattern, and that's how you do IO," where in reality this doesn't
showcase everything monads really do.

If you want to *link* to some good tutorials, I think that reading the
"All about monads" tutorial is a great way to learn Haskell, period.

Everyone in the Haskell cafe probably has a secret dream to give the
best "five minute monad talk."  Challenge: get someone to have a
competition at one of the conferences where students all give their
best "five minute monad talk" and try to find the most comprehensible
one!

Perhaps that was a bit of a rant, apologies if so,

kris

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


Re: [Haskell-cafe] Invitation to connect on LinkedIn

2012-09-12 Thread Kristopher Micinski
I believe these are the effect of linkedin harvesting your email contacts,
and then a blanket "invite all" link that you can click.  Whether it's
linkedin who's spamming, or the person who forgot to uncheck certain
mailing lists, that's more of a moral debate..

kris

On Wed, Sep 12, 2012 at 2:21 PM, damodar kulkarni wrote:

> Hi,
> Correct me if I am wrong, but by looking at the way the message is
> created, I think, LinkedIn is acting a kind of spammer these days. Shall we
> lodge protest against it as a community?
> As an aside, can we not automatically delete all messages to haskell
> mailing-lists whose "from" field contains "LinkedIn" (and the likes of it)
> in it?
>
> -Damodar
>
> On Wed, Sep 12, 2012 at 9:12 PM, Sakari Joinen via LinkedIn <
> mem...@linkedin.com> wrote:
>
>>
>>[image: LinkedIn Logo] 
>>
>>
>>
>>   Steve,
>>
>>Sakari Joinen wants to connect with you on LinkedIn.
>>
>>  Sakari Joinen
>>  Senior QA Engineer at Rocketpack  View Profile 
>> »
>>
>>   
>> Accept
>>
>>
>>
>>  You are receiving Invitation emails. 
>> Unsubscribe.
>>
>>
>> This email was intended for Steve Severance (Principal at Alpha Heavy
>> Industries). Learn why we included 
>> this.
>> © 2012, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043,
>> USA
>>
>>
>> ___
>> 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] ANNOUNCE: grid-1.1

2012-09-06 Thread Kristopher Micinski
On Thu, Sep 6, 2012 at 8:04 AM, Amy de Buitléir  wrote:
> Paul Visschers  paulvisschers.net> writes:
>
>> Looks nice. Does it scale well to millions of elements, and can it handle 3D?
>
> The current implementation wouldn't scale well to millions of elements, but it
> shouldn't take much tweaking to support that. Currently, when a grid is
> constructed, the list of all possible indices is constructed as well, so that
> calls to the "indices" function are fast. To support large numbers of tiles, I
> would instead generate all possible indices only when the "indices" function 
> is
> called. Then the indices function would be too slow to be usable for more 
> than,
> say, 50,000 tiles. But perhaps you don't need that function.
>

It seems like you should be able to stick this behind some abstraction
so that you can support multiple implementations for grids (i.e.,
currently storing indices as you mention, but could support other
implementations with different trade offs ...)?

kris

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


Re: [Haskell-cafe] From monads to monoids in a small category

2012-09-04 Thread Kristopher Micinski
Your post feels similar to another one posted recently...

http://web.jaguarpaw.co.uk/~tom/blog/2012/09/02/what-is-a-monad-really.html

just fyi, :-),

kris

On Tue, Sep 4, 2012 at 6:39 AM, Alberto G. Corona  wrote:
> "Monads are monoids in the category of endofunctors"
>
> This Monoid instance for the endofunctors of the set of all  elements
> of (m a)   typematch in Haskell with FlexibleInstances:
>
> instance Monad m => Monoid  (a -> m a) where
>mappend = (>=>)   -- kleisly operator
>mempty  = return
>
> The article can be found here:
>
> http://haskell-web.blogspot.com.es/2012/07/from-monads-to-monoids-in-small.html
>
> I would appreciate some comments.
>
> ___
> 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] Over general types are too easy to make.

2012-09-02 Thread Kristopher Micinski
On Sun, Sep 2, 2012 at 12:06 PM, Alexander Solla  wrote:
>
>
> On Sun, Sep 2, 2012 at 9:40 AM,  wrote:
>>
>> The thing is, that one ALWAYS wants to create a union of types, and not
>> merely an ad-hock list of data declarations.  So why does it take more code
>> to do "the right thing(tm)" than to do "the wrong thing(r)"?
>
>
> Because a union type is a complex union of parts, and the parts need to be
> deconstructed in order to be acted upon.  There is not a unique way to do
> this -- different "unwrappings" have different properties and must match
> your use case.
>
> Perhaps you should read "Data types ala carte" (W. Swiestra) [1], which
> provides an approach to constructing "open" data types (i.e., sum types to
> which new summands can be added)
>
>
> [1] http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf
>

If you're going to suggest that line of thinking you might also the
concept of rows in general.., though I'm not sure that's really quite
what he wants.

kris

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


Re: [Haskell-cafe] Function names in Haskell lib not first-class on web!

2012-08-30 Thread Kristopher Micinski
On Thu, Aug 30, 2012 at 11:21 PM, damodar kulkarni
 wrote:
> Hi Cafe,
> It seems, the function names in Haskell libs are not first-class objects, AT
> LEAST when it comes to searching for them of the net!
> I was trying to search for the following Haskell functions in the mailing
> list archives. Here is a summary of the responses I have had from various
> servers upon searching various "valid and normally used" Haskell function
> identifiers from well-known libraries.
>
> Responses from the http://www.mail-archive.com
>  >>=, It seems the script searched for the string "> >"
> * -> *There are 0 results.
> and so on...
>
> Responses from the http://search.gmane.org
>>>=  Here, too, it seems the script searched for the string "> >"
> * -> *  Here it seems the script searched for the string ">"
> and so on...
>
> Note: google badly fails to search these functions identifiers.
>
> My current solution to this problem is: download compressed text archives
> and do a simple grep on it on my machine.
>
> But the archives up to year 2000 only are found at
> http://www.haskell.org/pipermail/haskell-cafe/.
> So, as an aside: Where do I find the earlier messages for downloading?
>
> Thanks,
> Damodar
>

You know about Hoogle, right?

kris

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


Re: [Haskell-cafe] formal semantics

2012-08-25 Thread Kristopher Micinski
On Sat, Aug 25, 2012 at 3:38 PM, Jay Sulzberger  wrote:
> This is good.  I will look at the references given in this
> thread.  The account at
>
>
> http://web.archive.org/web/20060206074101/http://www.cse.ogi.edu/~mpj/thih/TypingHaskellInHaskell.html
>
> is, I think, one part of what I was looking for.
>

The book I recommend (although now I feel like a bad person because I
haven't read all of it :-(.., is "The Implementation of Functional
Languages,"

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

I remember finding it quite approachable, although for the immediate
need of trying to implement *Haskell* in a verified environment, it
might not be immediately helpful, it's really good background reading
on the subject that will be imperative should you want to do such
things (and written around the time when Haskell was congealing, so
should be representative-ish of the attitudes underlying Haskell's
design at the time: graph reduction, compiling pattern matching,
translating high level lamda languages to core semantics).

kris

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


Re: [Haskell-cafe] formal semantics

2012-08-25 Thread Kristopher Micinski
>
> I do not know Haskell.  It looks to me as though there are
> several pieces of the mechanism:
>
> 1. There is, once the extensions are specified, a particular Type
> System, that is, a formal system with, on the syntactic side, at
> least, assumptions, judgements, rules of inference, terms lying
> in some lambda calculus, etc..
>

That's right.  Extensions get complex too, however, and can't be
necessarily easily dismissed (not to imply you were doing so),
RankNTypes, for example,

> 2. The Type Inference Subsystem, which using some constraint
> solver calculates the type to be assigned to the value of Haskell
> expressions.
>

Yes, that's right, for core haskell this is typically damas milner
(let bound) polymorphism

> 3. The machine which does "reduction", perhaps "execution", on
> the value of Haskell expressions.  This is, by your account, the
> STG machine.
>

Yes, notably graph reduction allows sharing, which is an important
part of Haskell's semantics,

> There is a textual version of Haskell's Core.  If it were
> executable and the runtime were solid and very simple and clear
> in its design, I think we would have something close to a "formal
> semantics".  We'd also require that the translation to STG code
> be very simple.
>

Yes, that's right.  The translation to STG (or something like it,
another core language) can be found in many books and articles,

But others here have also specified some good references for
executable versions of Core.  Still unsure if the translation from
Haskell to Core has been verified, I would suspect not, as I haven't
heard of any such thing.

kris

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


Re: [Haskell-cafe] formal semantics

2012-08-25 Thread Kristopher Micinski
On Sat, Aug 25, 2012 at 9:33 AM, Gershom Bazerman  wrote:
> On 8/25/12 6:48 AM, Kristopher Micinski wrote:
>>
>> Thus, you typically want to think about the semantics of "core
>> Haskell," in which you might try understanding the semantics of the
>> STG machine.
>>
>
> Along those lines, there's Pirog and Biernacki's "A Systematic Derivation of
> the STG Machine
> Verified in Coq": http://www.cs.ox.ac.uk/files/3858/pirog-biernacki-hs10.pdf
>
> Googling for that to find the pdf also led me to this page of the Haskell
> Wiki, which has some good resources, but is, I'm sure, incomplete:
> http://www.haskell.org/haskellwiki/Language_and_library_specification
>
> Perhaps as material is assembled on the state of Haskell semantics, it can
> be added there as well to help others in the future.
>

Thanks for the pointers, Gershom, it seems reasonable that such a
thing would exist, but I hadn't been aware of it,

kris

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


Re: [Haskell-cafe] formal semantics

2012-08-25 Thread Kristopher Micinski
On Thu, Aug 23, 2012 at 12:23 PM, Ramana Kumar
 wrote:
> Dear Haskell Cafe
>
> I'm looking for information on past and current attempts to write semantics
> for Haskell.
> Features I'm particularly interested in are:
>
> formal
> mechanised
> maintainable
> up to date
>
> Of course, if nothing like that exists then partial attempts towards it
> could still be useful.
>
> My ultimate aims include:
>
> Make it viable to define Haskell formally (i.e. so mechanised semantics can
> take over the normative role of the Haskell reports).
> Write a verified (or verify an existing) Haskell compiler (where verified
> means semantics preserving).
>
> Cheers,
> Ramana
>

Ramana,

If you look through the Haskell reports, you'll see that the language
is typically explained by its desugaring to a "core" language which
has the semantics you'd "expect," in the sense that it's a call by
need abstract machine implemented by means of graph reduction in form
of the STG machine.

Thus, you typically want to think about the semantics of "core
Haskell," in which you might try understanding the semantics of the
STG machine.

You can certainly look at the classic article [1] that describes the
behavior, at a high level.  You might ask whether the high level
description of the STG machine really "makes sense," at which point
I'd direct you to a number of other articles (the one that sticks in
my memory, but I haven't really read deeply, is [2]).

It sounds, however, that you are looking for a more full description
of the language's semantics in a formal manner, going from "real"
Haskell to core Haskell, I feel such a reduction must surely exist but
I'm not sure I can recall one.

If you were to write a verified compiler, you would need a semantics
for the STG machine and show that it obeyed the rules you'd expect (a
call by name semantics), and then compose your proof for that with
your reduction of real Haskell to core Haskell..

kris

[1] "Implementing lazy functional languages on stock hardware: the
Spineless Tagless G-machine," Simon L. Peyton Jones,
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.3729
[2] "The Spineless Tagless G-machine, naturally," Jon Mountjoy,
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.13.8726

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