Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-23 Thread Limestraël
As some people were advising me to peek in Lua, I did so. Well, I find it
far too laxist and bug prone : weak-typing, variables which are global by
default, non-existing variables which contain nil when we access them
instead of failing...
I mean, I like Haskell especially because it is rigorous and because the
type-system continually saves the day: Lua is the total opposite. I don't
hope to enjoy Haskell's tightness with a scripting language, but being
interpreted and dynamically typed doesn't prevent to be somewhat painstaking
(Python is, for instance)**.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Brandon S. Allbery KF8NH

On May 4, 2010, at 01:52 , Maciej Piechotka wrote:

After change of file you have to wait a long time as it compiles and
links with yi. On my system (1 GB of RAM taken by system + 1 GB  
'free' +

2 GB swaps, x86-64) it could in some situations it caused OOM. I'd
prefer if the code was interpreted by ghci instead of compiled by  
GHC in

this case (it should be as fast as most of the code was compiled
anyway).



On the one hand, this is doable with the GHC API.  On the other, that  
more or less means your program contains what amounts to a full copy  
of GHC.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Brandon S. Allbery KF8NH

On May 5, 2010, at 21:49 , Pierre-Etienne Meunier wrote:

- all these =, significative indentation, You're from the past dude.



Careful, or Guido (van Rossum) is going to show up on your doorstep

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Brandon S. Allbery KF8NH

On May 6, 2010, at 11:08 , Donn Cave wrote:

different ambitions.  Who would pick Tcl for a programming language?
but it has been popular for scripting (still?  don't know.)  It would


I think Lua has superseded it, because it has the compactness  
advantage and easy embeddability of of the Tcl core but is enormously  
easier to write code in.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Limestraël
There is the package hint, which embeds the calls to GHC API.

Quite easy to use:
Let's say your configuration file (cfg/Script.hs) contains a function
script that you want to get:

type ScriptFun = IO ()

loadScript :: IO ScriptFun
loadScript = do
  liftM (either (error . show) id) $ runInterpreter $ do
path - get searchPath
set [searchPath := (./cfg:path)]
loadModules [Script]
setTopLevelModules [Script]
exports - getModuleExports Script
if Fun script `elem` exports
  then *interpret script (as :: ScriptFun)*
  else error script function not found


There is just the line I put in bold that bothers me. Can't we get the
action script more easily than by re-interpreting some code?

2010/5/8 Brandon S. Allbery KF8NH allb...@ece.cmu.edu

 On May 4, 2010, at 01:52 , Maciej Piechotka wrote:

 After change of file you have to wait a long time as it compiles and
 links with yi. On my system (1 GB of RAM taken by system + 1 GB 'free' +
 2 GB swaps, x86-64) it could in some situations it caused OOM. I'd
 prefer if the code was interpreted by ghci instead of compiled by GHC in
 this case (it should be as fast as most of the code was compiled
 anyway).



 On the one hand, this is doable with the GHC API.  On the other, that more
 or less means your program contains what amounts to a full copy of GHC.

 --
 brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
 system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
 electrical and computer engineering, carnegie mellon universityKF8NH



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


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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Brandon S. Allbery KF8NH

On May 7, 2010, at 19:51 , Limestraël wrote:

  then interpret script (as :: ScriptFun)

There is just the line I put in bold that bothers me. Can't we get  
the action script more easily than by re-interpreting some code?



Make up your mind:  you don't want to have to compile the script, but  
you don't want to have to interpret the script.  What exactly is  
supposed to be left?


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Pierre-Etienne Meunier
Shit ! I'll have to explain him how to add monads in python 3 ;-)


El 07/05/2010, a las 19:31, Brandon S. Allbery KF8NH escribió:

 On May 5, 2010, at 21:49 , Pierre-Etienne Meunier wrote:
 - all these =, significative indentation, You're from the past dude.
 
 
 Careful, or Guido (van Rossum) is going to show up on your doorstep
 
 -- 
 brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
 system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
 electrical and computer engineering, carnegie mellon universityKF8NH
 
 

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Pierre-Etienne Meunier
By the way, I do not know the GHC API well enough to say if it is possible to 
embed a super small bytecode interpreter, but :

- If it is the case, then users who do not want to write scripts can use it. 
Others would want to compile haskell code, therefore they need GHC anyway.
- If it is not, then a cool thing to do for the GHC team would be to add one ;-)

In both cases, if someone on haskell-cafe knows the answer, could he write it 
on the wiki in the page about the ghc api ?

Cheers,
PE

El 07/05/2010, a las 19:22, Brandon S. Allbery KF8NH escribió:

 On May 4, 2010, at 01:52 , Maciej Piechotka wrote:
 After change of file you have to wait a long time as it compiles and
 links with yi. On my system (1 GB of RAM taken by system + 1 GB 'free' +
 2 GB swaps, x86-64) it could in some situations it caused OOM. I'd
 prefer if the code was interpreted by ghci instead of compiled by GHC in
 this case (it should be as fast as most of the code was compiled
 anyway).
 
 
 On the one hand, this is doable with the GHC API.  On the other, that more or 
 less means your program contains what amounts to a full copy of GHC.
 
 -- 
 brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
 system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
 electrical and computer engineering, carnegie mellon universityKF8NH
 
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Pierre-Etienne Meunier
There is a also a problem with polymorphic actions of functions. The GHC API is 
typesafe only when returning elements of the Typeable class. Else you can do an 
unsafeCoerce, but I assume that hint uses Typeable, with a wrapper class to 
ensure monomorphism.

But if your script action returns a monomorphic type, you can use the GHC API 
directly instead and unsafeCoerce.


El 07/05/2010, a las 20:12, Brandon S. Allbery KF8NH escribió:

 On May 7, 2010, at 19:51 , Limestraël wrote:
   then interpret script (as :: ScriptFun)
 
 There is just the line I put in bold that bothers me. Can't we get the 
 action script more easily than by re-interpreting some code?
 
 
 Make up your mind:  you don't want to have to compile the script, but you 
 don't want to have to interpret the script.  What exactly is supposed to be 
 left?
 
 -- 
 brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
 system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
 electrical and computer engineering, carnegie mellon universityKF8NH
 
 
 ___
 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] Re: Haskell and scripting

2010-05-07 Thread Andy Stewart
Daniel Fischer daniel.is.fisc...@web.de writes:

 On Wednesday 05 May 2010 23:36:26, Limestraël wrote:
 but you will not object if I say that scheme is quicker to learn
 than Haskell.

 Well, I do object. Learning Haskell went like a breeze (not to perfection, 
 but well enough). Only Python was nearly as easy and quick to learn.
 Learning Lisp dialects is much harder (to a large part because of the 
 parentheses, which makes them near impossible to parse).
Perhaps you need perfect lisp editor (emacs) to help you parse those
parentheses. :)

Looks below extension to highlight parentheses if you're emacser.
It help you parse parentheses when you through *parentheses forest*.

http://www.emacswiki.org/emacs/HighlightParentheses

  -- Andy


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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Limestraël
You might have misunderstood me.

When using hint, one wants the script to be interpreted.
It is interpreted when called  loadModules [Script] , but if we call
later  interpret *something* (as :: Something) , the *something *can be
any Haskell code, not just a function name, which means hint has also to
interpret the *something*.
So, IMO, a double interpretation is done when a function such as getSymbol
*functionName *(as :: FuncType), which would simply get the function, would
be sufficient.
I don't know if hint/GHC API allows to do such a thing...


2010/5/8 Brandon S. Allbery KF8NH allb...@ece.cmu.edu

 On May 7, 2010, at 19:51 , Limestraël wrote:

   then *interpret script (as :: ScriptFun)*

 There is just the line I put in bold that bothers me. Can't we get the
 action script more easily than by re-interpreting some code?


 Make up your mind:  you don't want to have to compile the script, but you
 don't want to have to interpret the script.  What exactly is supposed to be
 left?

 --
 brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
 system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
 electrical and computer engineering, carnegie mellon universityKF8NH



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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Brandon S. Allbery KF8NH

On May 7, 2010, at 22:18 , Limestraël wrote:

When using hint, one wants the script to be interpreted.
It is interpreted when called  loadModules [Script] , but if we  
call later  interpret something (as :: Something) , the something  
can be any Haskell code, not just a function name, which means hint  
has also to interpret the something.


Not entirely clear to me, actually:  the earlier one might generate  
bytecode and the later one run it.  (I haven't looked at hint, but  
have some idea of what GHC-API can do.)


So, IMO, a double interpretation is done when a function such as  
getSymbol functionName (as :: FuncType), which would simply get  
the function, would be sufficient.

I don't know if hint/GHC API allows to do such a thing...


GHC API should let you look up names directly; as above, I don't know  
if hint does.  hs-plugins used to do this also but it is obsolete (was  
far too dependent on GHC internal data and had to be rewritten for  
every GHC release; the GHC API is more stable).


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Evan Laforge
 On the one hand, this is doable with the GHC API.  On the other, that more
 or less means your program contains what amounts to a full copy of GHC.

And the result is that your binary will grow by 35mb, add a few
seconds to launch time, the first expression will take 3 or 4 seconds
to evaluate, and add around 10 seconds to the link time.  After that
it's pretty reasonable though.

I've actually thought of embedding a version of hugs, that should be
smaller and faster, but as soon as you want to use significant amounts
of libraries it gets to be a hassle to keep the source around and it
may not even be hugs compatible anyway.  GHC's big advantage is it can
load the same binary libraries the rest of the program uses.  I don't
know if hugs was really designed to be embedded anyway.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-06 Thread Limestraël
^^
That's an interesting debate: How do you imagine the future programming
languages?
But not today's topic.
It's strange that, since Lisp is still used now, especially for teaching
purposes, and since everybody complains about parenthesises, nobody
developed a Lisp-like just based on indentation...
To my mind, I think that as long as you lay out well your code, Lisp is
quite readable. I don't see why the parenthesises would make it harder to
learn.

Daniel, prior to learn Haskell, did you know other functional languages?
Cause I didn't, and let me tell you that the functional way of coding wasn't
obvious while beginning (now I can't do without), especially the whole monad
thing.
Problem: Haskell without monads (or structures even more unusual, like
Arrows) is no longer Haskell (can be subject to debate, too), so you have to
get the point if you want to use properly the language. Or else you stuck to
quicksort-like algorithms which show the beauty of the language, but not its
power.

2010/5/6 Pierre-Etienne Meunier pierreetienne.meun...@gmail.com

 Fifty years ago someone came up with this idea of lisp and parentheses. By
 now in year 2010, I have never heard of any programmer who never made jokes
 about it. Now imagine the discussions in 2060 :

 - ahah, you're still programming with monads. lol
 - no but theyre ok for dirty scripting.
 - all these =, significative indentation, You're from the past dude.
 - Wtf !!? haskell's easy to compile.
 - So what ?

 ... good luck limestraël ;-)



 El 05/05/2010, a las 18:25, Gregory Crosswhite escribió:

 
  On May 5, 2010, at 3:09 PM, Daniel Fischer wrote:
 
  Learning Lisp dialects is much harder (to a large part because of the
  parentheses, which makes them near impossible to parse).
 
  On the contrary, the whole point of parentheses is that it makes Lisp
 *easier* to parse... for computers.  :-)
 
  Cheers,
  Greg
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe

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

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-06 Thread Donn Cave
Quoth =?ISO-8859-1?Q?Limestra=EBl?= limestr...@gmail.com,

 That's an interesting debate: How do you imagine the future programming
 languages?
 But not today's topic.

I think you're in a position to make the premise much more interesting,
by elaborating the kind of programming interface you want to expose.

We've been through the generalities of this discussion before - is map
hard, are for loops easy?  what if you never learned an imperative
language, does that make a difference, aren't functional languages the
most natural because everyone knows about equations, ... etc.  Oh, and
let's talk about LISP and decide whether it's a success or failure!

Scripting interfaces are an unusual twist, though.  Different audience,
different ambitions.  Who would pick Tcl for a programming language?
but it has been popular for scripting (still?  don't know.)  It would
be interesting to look at some hypothetical examples that script your
application, using Haskell vs. Lua or whatever.  Haskell might look
pretty good.  For example, you'll probably expose some application
data, and a programmer could easily be confused about whether a variable
is application global data or not, or confused about whether operations
on that variable are global in effect.  I'm guessing this would turn
out clearer in Haskell, along with other things having to do with
variables.

Donn Cave, d...@avvanta.com

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-06 Thread Daniel Fischer
On Thursday 06 May 2010 16:32:50, Limestraël wrote:
 ^^
 That's an interesting debate: How do you imagine the future programming
 languages?
 But not today's topic.
 It's strange that, since Lisp is still used now, especially for teaching
 purposes, and since everybody complains about parenthesises, nobody
 developed a Lisp-like just based on indentation...

Readable Lisp. Now, that could be an interesting language :)

 To my mind, I think that as long as you lay out well your code, Lisp is
 quite readable. I don't see why the parenthesises would make it harder
 to learn.

It's idiosyncratic. I just don't manage to see through them. If you don't 
get distracted by the parentheses, good for you.


 Daniel, prior to learn Haskell, did you know other functional languages?

No. Just some faint memories of Pascal from twenty years before and a bit 
of Java.
Haskell just matched the natural way of thinking pretty closely.
It might have something to do with the fact that I studied mathematics.

 Cause I didn't, and let me tell you that the functional way of coding
 wasn't obvious while beginning (now I can't do without), especially the
 whole monad thing.
 Problem: Haskell without monads (or structures even more unusual, like
 Arrows) is no longer Haskell (can be subject to debate, too), so you
 have to get the point if you want to use properly the language. Or else
 you stuck to quicksort-like algorithms which show the beauty of the
 language, but not its power.

 2010/5/6 Pierre-Etienne Meunier pierreetienne.meun...@gmail.com

  Fifty years ago someone came up with this idea of lisp and
  parentheses. By now in year 2010, I have never heard of any programmer
  who never made jokes about it.

I don't remember ever making a joke about it. But I'm not a programmer, so 
I'm not a counterexample.

 
  ... good luck limestraël ;-)
 

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-06 Thread Limestraël
Don Cave said:
 We've been through the generalities of this discussion before - is map
 hard, are for loops easy?  what if you never learned an imperative
 language, does that make a difference, aren't functional languages the
 most natural because everyone knows about equations, ... etc.

Oh yes.
The problem comes from the sole fact that -- generally -- we sadly start by
the imperative paradigm. I now there are a few universities, in France,
which teaches to the beginners Lisp or Ocaml, but they are not countless.
Moreover, call me an integrist but beginning students are usually dumb (I
was, so no offense): either they are stubborn and reject programmation
whatever the language is, or they are geeks who swear by regular languages
(*), mostly because gamemakers or software companies use them. They follow
the crowd. Time to change some minds.
But, hey, by swearing by functional programming I'm kind of a nonconformist
geek, too.

(*) Been there.

I'm digressing.


2010/5/6 Daniel Fischer daniel.is.fisc...@web.de
 Haskell just matched the natural way of thinking pretty closely.

I agree. Especially with datatypes. I personnaly don't think naturally in
objects, with notions of inheritance and such. IMO, it is much more human to
express in terms of alternatives.
A door is either unlocked or locked with a key:
data Door = Unlocked | Locked Key
(maybe not the best example but it's just the one that went through my mind)


2010/5/6 Daniel Fischer daniel.is.fisc...@web.de

  
   ... good luck limestraël ;-)
  

 Seconded.


I chose the Dyre method. The easy path. ^^
If I was trying to make a game, I should be trying hslua. Just sad I didn't
find an easy way to script in functional (*).

(*) Nonconformist geek hit again.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Niclas W
Limestraël limestrael at gmail.com writes:

 (*) functional language, because I want to keep the benefit of functional
 programming for scripting. So no Lua, no Python...

You might want to take another look at lua. It is pretty darn functional. Also
fast, small, and seems to be even easier to embed in haskell than in c.

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Limestraël
How do you embed Lua in Haskell?

2010/5/5 Niclas W nicl...@gmail.com

 Limestraël limestrael at gmail.com writes:

  (*) functional language, because I want to keep the benefit of functional
  programming for scripting. So no Lua, no Python...

 You might want to take another look at lua. It is pretty darn functional.
 Also
 fast, small, and seems to be even easier to embed in haskell than in c.

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

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Ivan Lazar Miljenovic
Limestraël limestr...@gmail.com writes:

 How do you embed Lua in Haskell?

http://hackage.haskell.org/package/hslua

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Limestraël
Thanks!

However, I don't forget that my goal is to get a system monitor
configuration language.

Lua may have some functional components, it remains imperative, I think a
more declarative language like Scheme would be more appropriate (and there
is also a scheme interpreter, haskeem).
What do you think about it?


2010/5/5 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com

 Limestraël limestr...@gmail.com writes:

  How do you embed Lua in Haskell?

 http://hackage.haskell.org/package/hslua

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com

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


Re[2]: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Bulat Ziganshin
Hello Ivan,

Wednesday, May 5, 2010, 4:43:48 PM, you wrote:
 How do you embed Lua in Haskell?
 http://hackage.haskell.org/package/hslua

tutorial: http://haskell.org/haskellwiki/HsLua


-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Uwe Hollerbach
As the author of haskeem, I'm thrilled that you are considering it,
but to be honest I'm not quite sure it's embeddable in the way (I
think) you want. If you want to give it a try, though, I'd be more
than happy to try to help.

best, Uwe

On 5/5/10, Limestraël limestr...@gmail.com wrote:
 Thanks!

 However, I don't forget that my goal is to get a system monitor
 configuration language.

 Lua may have some functional components, it remains imperative, I think a
 more declarative language like Scheme would be more appropriate (and there
 is also a scheme interpreter, haskeem).
 What do you think about it?


 2010/5/5 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com

 Limestraël limestr...@gmail.com writes:

  How do you embed Lua in Haskell?

 http://hackage.haskell.org/package/hslua

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com


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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Yitzchak Gale
Maciej Piechotka wrote:
 After change of file you have to wait a long time as it compiles and
 links with yi.

But Yi is a far bigger application than what Limestraël is talking
about. One of my computers is very old and much
less powerful than yours (let's just say that it has far less than
1 Gb memory in total). On that machine, xmonad, still much
larger than Limestraël's app, recompiles its configuration file
almost instantaneously. And of course, even that
fast recompile only happens when I change the configuration,
which is almost never.

I would try the xmonad approach to scripting in Haskell.
It is much simpler to implement than any of the others,
and much neater if you find that it works well.

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Limestraël
Yes, the xmonad approach is very neat, but I see 2 major (IMO) drawbacks to
it:
1) The end-user has to have GHC, and all the necessary libraries to compile
the configuration
2) A scripting language should be simple and QUICK to learn : Haskell is
clean, powerful but its learning takes time

Uwe, I noticed kind of recently the haskeem package, I have not tried it yet
and I didn't know its usability. If you say it's not made for that, then I
believe you.


2010/5/5 Yitzchak Gale g...@sefer.org

 Maciej Piechotka wrote:
  After change of file you have to wait a long time as it compiles and
  links with yi.

 But Yi is a far bigger application than what Limestraël is talking
 about. One of my computers is very old and much
 less powerful than yours (let's just say that it has far less than
 1 Gb memory in total). On that machine, xmonad, still much
 larger than Limestraël's app, recompiles its configuration file
 almost instantaneously. And of course, even that
 fast recompile only happens when I change the configuration,
 which is almost never.

 I would try the xmonad approach to scripting in Haskell.
 It is much simpler to implement than any of the others,
 and much neater if you find that it works well.

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

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Kyle Murphy
Concerning your second point, I think just about any functional language
isn't going to be simple or quick to learn. It's simply not a way of
approaching problems that your average person (even your average programmer)
is used to dealing with. Things like fold and map, the work horses of
functional programming, are simply too foreign to most peoples imperative
way of approaching problems.

-R. Kyle Murphy
--
Curiosity was framed, Ignorance killed the cat.


On Wed, May 5, 2010 at 16:29, Limestraël limestr...@gmail.com wrote:

 Yes, the xmonad approach is very neat, but I see 2 major (IMO) drawbacks to
 it:
 1) The end-user has to have GHC, and all the necessary libraries to compile
 the configuration
 2) A scripting language should be simple and QUICK to learn : Haskell is
 clean, powerful but its learning takes time

 Uwe, I noticed kind of recently the haskeem package, I have not tried it
 yet and I didn't know its usability. If you say it's not made for that, then
 I believe you.


 2010/5/5 Yitzchak Gale g...@sefer.org

 Maciej Piechotka wrote:
  After change of file you have to wait a long time as it compiles and
  links with yi.

 But Yi is a far bigger application than what Limestraël is talking
 about. One of my computers is very old and much
 less powerful than yours (let's just say that it has far less than
 1 Gb memory in total). On that machine, xmonad, still much
 larger than Limestraël's app, recompiles its configuration file
 almost instantaneously. And of course, even that
 fast recompile only happens when I change the configuration,
 which is almost never.

 I would try the xmonad approach to scripting in Haskell.
 It is much simpler to implement than any of the others,
 and much neater if you find that it works well.

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



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


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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Limestraël
I do agree, but you will not object if I say that scheme is quicker to learn
than Haskell.
Most of all, I think Haskell is far too rigorous to serve scripting purposes
for my app. Quick and dirty is clearly not the Haskell way.
And is think its the very intrinsic nature of scripting to be done fast.

Nevertheless, I'm not a bigot ^^, if you people think Lua is an appropriate
language for what I'm trying to do, and if it is convenient to use with
Haskell, then I'm willing to give it a go.


2010/5/5 Kyle Murphy orc...@gmail.com

 Concerning your second point, I think just about any functional language
 isn't going to be simple or quick to learn. It's simply not a way of
 approaching problems that your average person (even your average programmer)
 is used to dealing with. Things like fold and map, the work horses of
 functional programming, are simply too foreign to most peoples imperative
 way of approaching problems.


 -R. Kyle Murphy
 --
 Curiosity was framed, Ignorance killed the cat.


 On Wed, May 5, 2010 at 16:29, Limestraël limestr...@gmail.com wrote:

 Yes, the xmonad approach is very neat, but I see 2 major (IMO) drawbacks
 to it:
 1) The end-user has to have GHC, and all the necessary libraries to
 compile the configuration
 2) A scripting language should be simple and QUICK to learn : Haskell is
 clean, powerful but its learning takes time

 Uwe, I noticed kind of recently the haskeem package, I have not tried it
 yet and I didn't know its usability. If you say it's not made for that, then
 I believe you.


 2010/5/5 Yitzchak Gale g...@sefer.org

 Maciej Piechotka wrote:
  After change of file you have to wait a long time as it compiles and
  links with yi.

 But Yi is a far bigger application than what Limestraël is talking
 about. One of my computers is very old and much
 less powerful than yours (let's just say that it has far less than
 1 Gb memory in total). On that machine, xmonad, still much
 larger than Limestraël's app, recompiles its configuration file
 almost instantaneously. And of course, even that
 fast recompile only happens when I change the configuration,
 which is almost never.

 I would try the xmonad approach to scripting in Haskell.
 It is much simpler to implement than any of the others,
 and much neater if you find that it works well.

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



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



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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Gwern Branwen
On Wed, May 5, 2010 at 4:29 PM, Limestraël limestr...@gmail.com wrote:
 Yes, the xmonad approach is very neat, but I see 2 major (IMO) drawbacks to
 it:
 1) The end-user has to have GHC, and all the necessary libraries to compile
 the configuration
 2) A scripting language should be simple and QUICK to learn : Haskell is
 clean, powerful but its learning takes time

For basic customization, many XMonad users (judging by questions on
#xmonad) have little to no Haskell experience and get by. Further,
it's easier to step down the power than to increase it; because we use
Haskell, it's possible to have simpler configuration options like
xmonad-light*

* http://braincrater.wordpress.com/2008/08/28/announcing-xmonad-light/
isn't a very good explanation of xmonad-light, but I don't know of any
others

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Limestraël
Well, it is clear that, for me, the dyre approach is clearly the simplest to
implement, since everything is in Haskell.
Maybe I could start with it, and see if it suits me... (Sorry, I know, ^^ I
keep changing my mind...)


2010/5/5 Gwern Branwen gwe...@gmail.com

 On Wed, May 5, 2010 at 4:29 PM, Limestraël limestr...@gmail.com wrote:
  Yes, the xmonad approach is very neat, but I see 2 major (IMO) drawbacks
 to
  it:
  1) The end-user has to have GHC, and all the necessary libraries to
 compile
  the configuration
  2) A scripting language should be simple and QUICK to learn : Haskell is
  clean, powerful but its learning takes time

 For basic customization, many XMonad users (judging by questions on
 #xmonad) have little to no Haskell experience and get by. Further,
 it's easier to step down the power than to increase it; because we use
 Haskell, it's possible to have simpler configuration options like
 xmonad-light*

 * http://braincrater.wordpress.com/2008/08/28/announcing-xmonad-light/
 isn't a very good explanation of xmonad-light, but I don't know of any
 others

 --
 gwern

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Daniel Fischer
On Wednesday 05 May 2010 23:36:26, Limestraël wrote:
 but you will not object if I say that scheme is quicker to learn
 than Haskell.

Well, I do object. Learning Haskell went like a breeze (not to perfection, 
but well enough). Only Python was nearly as easy and quick to learn.
Learning Lisp dialects is much harder (to a large part because of the 
parentheses, which makes them near impossible to parse).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Gregory Crosswhite

On May 5, 2010, at 3:09 PM, Daniel Fischer wrote:

 Learning Lisp dialects is much harder (to a large part because of the 
 parentheses, which makes them near impossible to parse).

On the contrary, the whole point of parentheses is that it makes Lisp *easier* 
to parse... for computers.  :-)

Cheers,
Greg

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Ivan Miljenovic
On 6 May 2010 08:25, Gregory Crosswhite gcr...@phys.washington.edu wrote:

 On May 5, 2010, at 3:09 PM, Daniel Fischer wrote:

 Learning Lisp dialects is much harder (to a large part because of the
 parentheses, which makes them near impossible to parse).

 On the contrary, the whole point of parentheses is that it makes Lisp 
 *easier* to parse... for computers.  :-)

With the added advantage of making it easier for text editors to do
automatic indentation properly for precisely the same reason (this is
probably the only flaw with Haskell's indentation-centric coding
style).

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Pierre-Etienne Meunier
Fifty years ago someone came up with this idea of lisp and parentheses. By now 
in year 2010, I have never heard of any programmer who never made jokes about 
it. Now imagine the discussions in 2060 :

- ahah, you're still programming with monads. lol
- no but theyre ok for dirty scripting.
- all these =, significative indentation, You're from the past dude.
- Wtf !!? haskell's easy to compile.
- So what ?

... good luck limestraël ;-)



El 05/05/2010, a las 18:25, Gregory Crosswhite escribió:

 
 On May 5, 2010, at 3:09 PM, Daniel Fischer wrote:
 
 Learning Lisp dialects is much harder (to a large part because of the 
 parentheses, which makes them near impossible to parse).
 
 On the contrary, the whole point of parentheses is that it makes Lisp 
 *easier* to parse... for computers.  :-)
 
 Cheers,
 Greg
 
 ___
 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] Re: Haskell and scripting

2010-05-03 Thread Pierre-Etienne Meunier
Hi,

You do not need a DSL at all, in fact. The simplest way to do this, if you use 
GHC, is to use the GHC api. This can compile everything for you, and return a 
value with type Dynamic, from Data.Dynamic and Data.Typeable. It is 
type-safe, you can write within very little time (even if the documentation for 
the GHC api is not -- yet -- perfect), and use a real language whose users are 
still alive.

Cheers,
PE

ps : by the way, if you are interested by this kind of programming, I saw that 
someone was writing a shell in haskell, called hashell I think. If you want to 
help him...

 Hello Café,
 
 I don't know if you know
 conkyhttp://en.wikipedia.org/wiki/Conky_%28software%29.
 It's a well-known open-source system monitor (a software that displays
 information on the desktop, like CPU frequency, disk usage, network rate,
 etc.).
 It is quite good, but it's very descriptive, and even if you can call shell
 commands it's clearly not made for being scripted.
 What I would do is to make a similar system monitor, which base would be
 compiled Haskell code, but that would be scriptable with some DSL, or
 already existing interpreted language.
 I've thought about a Lisp/Scheme language, since those languages are
 functional, dynamically typed and simple (so enable a quick scripting) and
 I'm not very keen on making my own DSL
 
 What I would like to know is:
 1) If you have other solutions
 2) How do haskellers usually script their applications

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


[Haskell-cafe] Re: Haskell and scripting

2010-05-03 Thread Maciej Piechotka
On Tue, 2010-05-04 at 00:45 +0200, Limestraël wrote:
 
 Minh, Kyle, Gwern, the dyre approach seems to be very interesting too.
 But if I understood well, we also have to recompile at run-time the
 configuration haskell script?
 So the final application (Yi, for instance) will need GHC to be
 installed to run? Or did I miss something?
 By the way, I had never heard of Yi, but can I deduce from its name
 its a Vi(m)-like (which I am a big fan of)? Moreover, the idea of
 scripting my editor in Haskell appeals me. 

1. Yi is more emacs-like in the internals (i.e. have embedded scripting
language - Haskell - to configure. See emacs goodness on yi haskell wiki
page) but on the skit it can use both emacs and yi style (or anything
you happen to configure it with IIRC).

2. I haven't tried to run it w/out GHC but it recompiles it as it needs
so if there is no change in configuration file and there is compiled
program it just runs it.

3. It sounds better then it is IMHO. Don't get me wrong - Haskell is
wonderful language and in syntax/libraries it suits scripting well.
However GHC do not.

After change of file you have to wait a long time as it compiles and
links with yi. On my system (1 GB of RAM taken by system + 1 GB 'free' +
2 GB swaps, x86-64) it could in some situations it caused OOM. I'd
prefer if the code was interpreted by ghci instead of compiled by GHC in
this case (it should be as fast as most of the code was compiled
anyway).

Regards


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