[Haskell-cafe] ML 2013: last call for presentations

2013-06-19 Thread Daan Leijen
There are still a few days left to write a short talk proposal 
for the ML workshop 2013! Since there are no official proceedings, 
this is an ideal venue if you are working on a  full submission 
for some other conference but want to talk about the  work early 
on and get useful community feedback.

Hope to see you there,
-- Daan 


ACM SIGPLAN Workshop on ML
Sunday, September 22, 2013, Boston MA
(co-located with ICFP)

http://research.microsoft.com/en-us/um/people/daan/mlworkshop2013
=== 

The ML family of programming languages includes dialects known as
Standard ML, OCaml, and F#.  These languages have inspired a large
amount of computer-science research, both practical and theoretical.
This workshop aims to provide a forum where users, developers and
researchers of ML languages and related technology can interact and
discuss ongoing research, open problems and innovative applications.
  
The ML workshop has adopted an informal model since 2010. It is a 
workshop with presentations selected from submitted abstracts. There 
are no published proceedings, so any contributions may be submitted 
for publication elsewhere. We hope that this format encourages the 
presentation of exciting (if unpolished) research and deliver a lively 
workshop atmosphere.

SCOPE
-

We seek research presentations on topics related to ML, including but
not limited to

  * Applications: case studies, experience reports, pearls, etc.
  * Extensions: higher forms of polymorphism, generic programming,
objects, concurrency, distribution and mobility, semi-structured
data handling, etc.
  * Type systems: inference, effects, overloading, modules, contracts,
specifications and assertions, dynamic typing, error reporting, etc.
  * Implementation: compilers, interpreters, type checkers, partial
evaluators, runtime systems, garbage collectors, etc.
  * Environments: libraries, tools, editors, debuggers, cross-language
interoperability, functional data structures, etc.
  * Semantics: operational, denotational, program equivalence,
parametricity, mechanization, etc.

Three kinds of submissions will be accepted: Research Presentations,
Experience Reports and Demos.

  * Research Presentations: Research presentations should describe new
ideas, experimental results, significant advances in ML-related
projects, or informed positions regarding proposals for
next-generation ML-style languages.  We especially encourage
presentations that describe work in progress, that outline a
future research agenda, or that encourage lively discussion.
These presentations should be structured in a way which can be, at
least in part, of interest to (advanced) users.

  * Experience Reports: Users are invited to submit Experience Reports
about their use of ML languages. These presentations do not need
to contain original research but they should tell an interesting
story to researchers or other advanced users, such as an
innovative or unexpected use of advanced features or a description
of the challenges they are facing or attempting to solve.

  * Demos: Live demonstrations or short tutorials should show new
developments, interesting prototypes, or work in progress, in the
form of tools, libraries, or applications built on or related to
ML.  (Please note that you will need to provide all the hardware
and software required for your demo; the workshop organizers are
only able to provide a projector.)

Each presentation should take 20-25 minutes, except demos, which
should take 10-15 minutes.  The exact time will be decided based on
the number of accepted submissions.


SUBMISSION INSTRUCTIONS
---

Submissions should be at most two pages, in PDF format, and printable
on US Letter or A4 sized paper. Submissions longer than half a page
should include a one-paragraph synopsis suitable for inclusion in the
workshop program.

Submissions must be uploaded to the following website before the
submission deadline (2013-06-21):

  https://www.easychair.org/conferences/?conf=ml2013

For any question concerning the scope of the workshop or the
submission process, please contact the program chair
(daan at microsoft.com).


IMPORTANT DATES
---

  * Friday, June 21 : Submission
  * Monday, July 22 : Notification
  * Sunday, September 22: Workshop


PROGRAM COMMITTEE
-

  Daan Leijen (chair) (Microsoft Research, US) 
  Jesse A. Tov(Harvard University, US) 
  Derek Dreyer(MPI-SWS, Germany) 
  Atsushi Ohori   (Univ. of Tohoku, Japan) 
  Lars Bergstrom  (Univ. of Chicago, US) 
  Jean Yang   (MIT CSAIL, US) 
  Gavin Bierman   (Microsoft Research, Cambridge, UK) 
  Tomas Petricek  (Univ. of Cambridge, UK) 
  Yukiyoshi Kameyama  (Univ. of Tsukuba, Japan) 
  Peter Thiemann  (Univ. of Freiburg, Germany) 


STEERING COMMITTEE

[Haskell-cafe] GADTs and pattern matching

2013-06-19 Thread Francesco Mazzoli
Hi list,

I have stumbled upon a strange annoyance:

{-# LANGUAGE GADTs #-}

data Foo v where
Foo :: Foo (Maybe v)

-- This doesn't work
foo1 :: a - Foo a - Int
foo1 Nothing  Foo = undefined
foo1 (Just x) Foo = undefined

-- This does
foo2 :: a - Foo a - Int
foo2 x Foo = foo2' x

foo2' :: Maybe a - Int
foo2' Nothing  = undefined
foo2' (Just x) = undefined

The first definition fails with the error

Couldn't match expected type `a' with actual type `Maybe t0'
  `a' is a rigid type variable bound by
  the type signature for foo1 :: a - Foo a - Int
  at /tmp/foo_flymake.hs:8:9
In the pattern: Nothing
In an equation for `foo1': foo1 Nothing Foo = undefined

Now, GHC can clearly derive and use the type equalities correctly, given
that the second definition works, but why can’t I pattern match
directly?

Thanks,
Francesco

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


Re: [Haskell-cafe] GADTs and pattern matching

2013-06-19 Thread AntC
Francesco Mazzoli f at mazzo.li writes:

 
 I have stumbled upon a strange annoyance:
 
 {-# LANGUAGE GADTs #-}

Hi Francesco, I think you'll find that the 'annoyance' is nothing to do 
with GADTs. I suggest you take the type signature off of foo1, and see 
what type ghc infers for it. It isn't :: a - Foo a - Int.

 data Foo v where
 Foo :: Foo (Maybe v)
 
 -- This doesn't work
 --    foo1 :: a - Foo a - Int
 foo1 Nothing  Foo = undefined
 foo1 (Just x) Foo = undefined
  ...
 
 The first definition fails with the error
 
 Couldn't match expected type `a' with actual type `Maybe t0'
 ...
 In the pattern: Nothing

Yep, that message explains what's going on well enough for me.


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


Re: [Haskell-cafe] GADTs and pattern matching

2013-06-19 Thread Francesco Mazzoli
At Wed, 19 Jun 2013 10:03:27 + (UTC),
AntC wrote:
 Hi Francesco, I think you'll find that the 'annoyance' is nothing to do 
 with GADTs. I suggest you take the type signature off of foo1, and see 
 what type ghc infers for it. It isn't :: a - Foo a - Int.
 
 [...]

 Yep, that message explains what's going on well enough for me.

Did you read the rest of the code?  That ought to work, because GHC
infers and uses the type equality (something like ‘v ~ Var v1’) and uses
it to coerce the ‘x’.

And, surprise surprise, if the argument order is switched, it works!

data Foo v where
Foo :: forall v. Foo (Maybe v)

foo1 :: Foo a - a - Int
foo1 Foo Nothing  = undefined
foo1 Foo (Just x) = undefined

Francesco

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


Re: [Haskell-cafe] GADTs and pattern matching

2013-06-19 Thread Brent Yorgey
On Wed, Jun 19, 2013 at 11:11:16AM +0100, Francesco Mazzoli wrote:
 At Wed, 19 Jun 2013 10:03:27 + (UTC),
 AntC wrote:
  Hi Francesco, I think you'll find that the 'annoyance' is nothing to do 
  with GADTs. I suggest you take the type signature off of foo1, and see 
  what type ghc infers for it. It isn't :: a - Foo a - Int.
  
  [...]
 
  Yep, that message explains what's going on well enough for me.
 
 Did you read the rest of the code?  That ought to work, because GHC
 infers and uses the type equality (something like ‘v ~ Var v1’) and uses
 it to coerce the ‘x’.
 
 And, surprise surprise, if the argument order is switched, it works!
 
 data Foo v where
 Foo :: forall v. Foo (Maybe v)
 
 foo1 :: Foo a - a - Int
 foo1 Foo Nothing  = undefined
 foo1 Foo (Just x) = undefined

Yes, I was going to suggest switching the argument order before
reading your message.  This is an interesting way in which you can
observe that Haskell does not really have multi-argument functions.
All multi-argument functions are really one-argument functions which
return functions.  So a function of type

  foo1 :: a - (Foo a - Int)

must take something of type a (for *any* choice of a, which the caller
gets to choose) and return a function of type (Foo a - Int).  *Which*
function is returned (e.g. one that tries to pattern match on the Foo)
makes no difference to whether foo1 typechecks.

On the other hand, a function of type

  foo2 :: Foo a - (a - Int)

receives something of type Foo a as an argument.  It may pattern-match
on the Foo a, thus bringing into scope the fact that (a ~ Maybe v).
Now when constructing the output function of type (a - Int) it may
make use of this fact.

-Brent

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


Re: [Haskell-cafe] ANN: Nomyx 0.2 beta, the game where you can change the rules

2013-06-19 Thread Brent Yorgey
This is great fun, more people should come and join us! =)

  http://www.nomyx.net:8000/Nomyx

we are playing game demo3.

-Brent

On Fri, Jun 14, 2013 at 05:57:57PM +0200, Corentin Dupont wrote:
 Hello everybody!
 Here it comes, the second beta release [1] of Nomyx, the only game where
 You can change the rules!!
 This is an implementation of a Nomic [2] game in Haskell (I believe the
 first complete implementation of a Nomic game on a computer). In a
 Nomyxgame you can change the rules of the game itself while playing
 it. The
 players can submit new rules or modify existing ones, thus completely
 changing the behaviour of the game through time. The rules are managed and
 interpreted by the computer. They must be written in the Nomyx language,
 which is a subset of Haskell.
 
 At the beginning, the initial rules are describing:
 - how to add new rules and change existing ones. For example a unanimity
 vote is necessary to have a new rule accepted.
 - how to win the game. For example you win the game if you have 5 rules
 accepted.
 But of course even that can be changed!
 
 Here is a video introduction and first tutorial of the game:
 http://vimeo.com/58265498
 The game is running here: www.nomyx.net:8000/Nomyx
 I have set up a forum where players can learn about Nomyx and discuss the
 rules they intend to propose: www.nomyx.net/forum
 The example file gives a lot of examples of rules that you can submit:
 www.nomyx.net:8000/src/Language/Nomyx/Examples.hs
 
 Changes from V0.1:
 - new login system: you can now login with your Google, Yahoo, Live
 Journal, Myspace, OpenId or Facebook accounts (thanks to
 happstack-authenticate)!
 - new DSL for voting (see below)
 - styling: rule code colorized, better settings and help
 - use cookies to store the user ID (as suggested on this mailing list)
 - new error system to handle exceptions in rules (with ErrorT)
 - use lenses
 
 I set up a little DSL to create elections (elect one of the players for a
 special role) or referendums (a yes/no question).
 You create in one line within Nomyx an vote with unanimity or majority, a
 quorum and different ballot systems. See here:
 http://www.nomyx.net/forum/viewtopic.php?f=3t=1518
 
 Let's test it! If you are interested, please go to this forum thread and
 we'll set up a small team to start a match!
 http://www.nomyx.net/forum/viewtopic.php?f=4t=1517
 The demo game is running here: www.nomyx.net:8000/Nomyx then select game
 demo2.
 As the first player of the game, I changed the initial unanimity vote to a
 simple majority, with a minimum of 2 players voting. Having your new rules
 accepted will be easy!
 Let's see who will win :)
 
 Cheers,
 Corentin
 
 [1] http://hackage.haskell.org/package/Nomyx
 [2] www.nomic.net

 ___
 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] GADTs and pattern matching

2013-06-19 Thread Francesco Mazzoli
At Wed, 19 Jun 2013 06:59:00 -0400,
Brent Yorgey wrote:
 Yes, I was going to suggest switching the argument order before
 reading your message.  This is an interesting way in which you can
 observe that Haskell does not really have multi-argument functions.
 All multi-argument functions are really one-argument functions which
 return functions.  So a function of type
 
   foo1 :: a - (Foo a - Int)
 
 must take something of type a (for *any* choice of a, which the caller
 gets to choose) and return a function of type (Foo a - Int).  *Which*
 function is returned (e.g. one that tries to pattern match on the Foo)
 makes no difference to whether foo1 typechecks.
 
 On the other hand, a function of type
 
   foo2 :: Foo a - (a - Int)
 
 receives something of type Foo a as an argument.  It may pattern-match
 on the Foo a, thus bringing into scope the fact that (a ~ Maybe v).
 Now when constructing the output function of type (a - Int) it may
 make use of this fact.

Hi Brent,

Thanks for your answer.

I was reminded by shachaf on Haskell a few moments ago about the details
of pattern matching in GHC
http://www.haskell.org/pipermail/glasgow-haskell-users/2013-June/023994.html.

However, I’d argue that the issue doesn’t have much to do with the fact
that Haskell has only ‘1 argument functions’, at least at the type
level.  It’s more about how Haskell treats pattern matching.

In Agda/Epigram/Idris pattern matching works the other way around: they
allow it only in top-level definitions, and every other kind of match
get desugared to a new top level definition.  Thus you can reason about
the constraints on all the arguments in a better way.  Lately I’ve grown
used to that kind of pattern matching :).

In Haskell however where you expect _|_ and diverging matches, so it
probably makes more sense to have matching like is is now, otherwise
you’d have to force arguments to get equalities concerning earlier
arguments and things would probably get really messy.

Francesco

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


Re: [Haskell-cafe] ANN: Nomyx 0.2 beta, the game where you can change the rules

2013-06-19 Thread Corentin Dupont
Thanks Brent! I'm glad you like it.
You will win a lot of money if new players come :)
Indeed Brent proposed a rule that allows sponsorship: if you invite a
player in, you win 50 ECU...

The game is still in beta-phase, so expect bugs...
There is some learning material in the links in my mail under (see the
forum).

Best,
Corentin**


On Wed, Jun 19, 2013 at 1:01 PM, Brent Yorgey byor...@seas.upenn.eduwrote:

 This is great fun, more people should come and join us! =)

   http://www.nomyx.net:8000/Nomyx

 we are playing game demo3.

 -Brent

 On Fri, Jun 14, 2013 at 05:57:57PM +0200, Corentin Dupont wrote:
  Hello everybody!
  Here it comes, the second beta release [1] of Nomyx, the only game where
  You can change the rules!!
  This is an implementation of a Nomic [2] game in Haskell (I believe the
  first complete implementation of a Nomic game on a computer). In a
  Nomyxgame you can change the rules of the game itself while playing
  it. The
  players can submit new rules or modify existing ones, thus completely
  changing the behaviour of the game through time. The rules are managed
 and
  interpreted by the computer. They must be written in the Nomyx language,
  which is a subset of Haskell.
 
  At the beginning, the initial rules are describing:
  - how to add new rules and change existing ones. For example a unanimity
  vote is necessary to have a new rule accepted.
  - how to win the game. For example you win the game if you have 5 rules
  accepted.
  But of course even that can be changed!
 
  Here is a video introduction and first tutorial of the game:
  http://vimeo.com/58265498
  The game is running here: www.nomyx.net:8000/Nomyx
  I have set up a forum where players can learn about Nomyx and discuss the
  rules they intend to propose: www.nomyx.net/forum
  The example file gives a lot of examples of rules that you can submit:
  www.nomyx.net:8000/src/Language/Nomyx/Examples.hs
 
  Changes from V0.1:
  - new login system: you can now login with your Google, Yahoo, Live
  Journal, Myspace, OpenId or Facebook accounts (thanks to
  happstack-authenticate)!
  - new DSL for voting (see below)
  - styling: rule code colorized, better settings and help
  - use cookies to store the user ID (as suggested on this mailing list)
  - new error system to handle exceptions in rules (with ErrorT)
  - use lenses
 
  I set up a little DSL to create elections (elect one of the players for a
  special role) or referendums (a yes/no question).
  You create in one line within Nomyx an vote with unanimity or majority, a
  quorum and different ballot systems. See here:
  http://www.nomyx.net/forum/viewtopic.php?f=3t=1518
 
  Let's test it! If you are interested, please go to this forum thread and
  we'll set up a small team to start a match!
  http://www.nomyx.net/forum/viewtopic.php?f=4t=1517
  The demo game is running here: www.nomyx.net:8000/Nomyx then select game
  demo2.
  As the first player of the game, I changed the initial unanimity vote to
 a
  simple majority, with a minimum of 2 players voting. Having your new
 rules
  accepted will be easy!
  Let's see who will win :)
 
  Cheers,
  Corentin
 
  [1] http://hackage.haskell.org/package/Nomyx
  [2] www.nomic.net

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


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

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


[Haskell-cafe] hand over maintenance of a package

2013-06-19 Thread Corentin Dupont
Hi Cafe,
How to hand over the maintenance of a hackage package?
Thanks
Corentin
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] hand over maintenance of a package

2013-06-19 Thread Tikhon Jelvis
As far as I know, Hackage does not enforce control of a given package at
all. You can just have the new maintainer upload a new version of the
package, changing the maintainer field of the .cabal file.
On Jun 19, 2013 7:10 AM, Corentin Dupont corentin.dup...@gmail.com
wrote:

 Hi Cafe,
 How to hand over the maintenance of a hackage package?
 Thanks
 Corentin

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


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


Re: [Haskell-cafe] ANN: Nomyx 0.2 beta, the game where you can change the rules

2013-06-19 Thread Tobias Dammers
On Wed, Jun 19, 2013 at 01:18:54PM +0200, Corentin Dupont wrote:
 Thanks Brent! I'm glad you like it.
 You will win a lot of money if new players come :)
 Indeed Brent proposed a rule that allows sponsorship: if you invite a
 player in, you win 50 ECU...

Joined a game, though I don't really have time to look into it right
now. 

One thing though: It appears that the game sends multipart/alternative
e-mail messages, where the text/plain part is completely empty (0
bytes). Since I've configured my mail client to prefer text/plain over
text/html, this is kind of inconvenient.

Otherwise, good job. I'm curious where this is going.


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


Re: [Haskell-cafe] ANN: Nomyx 0.2 beta, the game where you can change the rules

2013-06-19 Thread Corentin Dupont
Thanks Tobias, I'm looking forward to see you in the game!
I'll try to fix the text/plain part of the mails. I had quite some problems
with the haskell command *simpleMail* some time ago.

Best,
Corentin

On Wed, Jun 19, 2013 at 3:48 PM, Tobias Dammers tdamm...@gmail.com wrote:

 On Wed, Jun 19, 2013 at 01:18:54PM +0200, Corentin Dupont wrote:
  Thanks Brent! I'm glad you like it.
  You will win a lot of money if new players come :)
  Indeed Brent proposed a rule that allows sponsorship: if you invite a
  player in, you win 50 ECU...

 Joined a game, though I don't really have time to look into it right
 now.

 One thing though: It appears that the game sends multipart/alternative
 e-mail messages, where the text/plain part is completely empty (0
 bytes). Since I've configured my mail client to prefer text/plain over
 text/html, this is kind of inconvenient.

 Otherwise, good job. I'm curious where this is going.


 ___
 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] GADTs and pattern matching

2013-06-19 Thread Felipe Almeida Lessa
Brent, maybe I'm misunderstanding what you're saying, but I don't
think that the order of the arguments is playing any role here besides
defining the order in which the pattern matches are desugared.

To illustrate,

  -- This does work
  foo1' :: a - Foo a - Int
  foo1' m Foo = case m of
  Nothing - undefined
  Just _  - undefined

Despite having the same type as foo1, foo1' does work because now I've
pattern matched on the GADT first.  As soon as I do that, its equality
constraint of (a ~ Maybe v) enters into scope of the case branches.

Cheers,

On Wed, Jun 19, 2013 at 7:59 AM, Brent Yorgey byor...@seas.upenn.edu wrote:
 On Wed, Jun 19, 2013 at 11:11:16AM +0100, Francesco Mazzoli wrote:
 At Wed, 19 Jun 2013 10:03:27 + (UTC),
 AntC wrote:
  Hi Francesco, I think you'll find that the 'annoyance' is nothing to do
  with GADTs. I suggest you take the type signature off of foo1, and see
  what type ghc infers for it. It isn't :: a - Foo a - Int.
 
  [...]
 
  Yep, that message explains what's going on well enough for me.

 Did you read the rest of the code?  That ought to work, because GHC
 infers and uses the type equality (something like ‘v ~ Var v1’) and uses
 it to coerce the ‘x’.

 And, surprise surprise, if the argument order is switched, it works!

 data Foo v where
 Foo :: forall v. Foo (Maybe v)

 foo1 :: Foo a - a - Int
 foo1 Foo Nothing  = undefined
 foo1 Foo (Just x) = undefined

 Yes, I was going to suggest switching the argument order before
 reading your message.  This is an interesting way in which you can
 observe that Haskell does not really have multi-argument functions.
 All multi-argument functions are really one-argument functions which
 return functions.  So a function of type

   foo1 :: a - (Foo a - Int)

 must take something of type a (for *any* choice of a, which the caller
 gets to choose) and return a function of type (Foo a - Int).  *Which*
 function is returned (e.g. one that tries to pattern match on the Foo)
 makes no difference to whether foo1 typechecks.

 On the other hand, a function of type

   foo2 :: Foo a - (a - Int)

 receives something of type Foo a as an argument.  It may pattern-match
 on the Foo a, thus bringing into scope the fact that (a ~ Maybe v).
 Now when constructing the output function of type (a - Int) it may
 make use of this fact.

 -Brent

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



-- 
Felipe.

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


[Haskell-cafe] ANNOUNCE: Ajhc 0.8.0.6 Release

2013-06-19 Thread Kiwamu Okabe
We are happy to announce Ajhc 0.8.0.6.
Major change on the release is supporting THREAD. Yeah!

You can get Ajhc using cabal install ajhc command.
Ajhc's project web site is found at http://ajhc.metasepi.org/.
You find the source code at https://github.com/ajhc/ajhc/tags.
Welcome sending any bugs or your ideas to https://github.com/ajhc/ajhc/issues.

## Good news

* You can use forkOS interface on Ajhc.
* Your program runs on pthread with compiling -fpthread option. See below.

$ cat Main.hs
import Control.Monad
import Control.Concurrent

main :: IO ()
main = do
  l - putStrLn Type some string and enter.  getLine
  forkOS $ (forever $ putChar '*')
  forkOS $ (forever $ putStr l)
  forever $ putChar '.'
$ ajhc -fpthread Main.hs
$ ./hs.out

## Bad news

* Ajhc guards critical section only for the runtime.
* Example: StablePtr isn't guarded with lock.
* Ajhc's thread can't share any objects without Ptr type.
* And you may find funny pthread bugs. Please send us the report!

## Other changes

* No more depend on DrIFT.
* Add _JHC_JGC_LIMITED_NUM_GC_STACK flag to set number of limited
gc_stack entries.
* Add _JHC_JGC_FIXED_MEGABLOCK flag to set number of limited megablock entries.
* Add compile flags -fcustomthread -fpthread -fnothread.
* You can implement your own thread API for Ajhc, if you choose -fcustomthread.

Enjoy! ;)
- - -
Metasepi team

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


Re: [Haskell-cafe] GADTs and pattern matching

2013-06-19 Thread Brent Yorgey
Good point.  I stand corrected.

-Brent

On Wed, Jun 19, 2013 at 11:42:23AM -0300, Felipe Almeida Lessa wrote:
 Brent, maybe I'm misunderstanding what you're saying, but I don't
 think that the order of the arguments is playing any role here besides
 defining the order in which the pattern matches are desugared.
 
 To illustrate,
 
   -- This does work
   foo1' :: a - Foo a - Int
   foo1' m Foo = case m of
   Nothing - undefined
   Just _  - undefined
 
 Despite having the same type as foo1, foo1' does work because now I've
 pattern matched on the GADT first.  As soon as I do that, its equality
 constraint of (a ~ Maybe v) enters into scope of the case branches.
 
 Cheers,
 
 On Wed, Jun 19, 2013 at 7:59 AM, Brent Yorgey byor...@seas.upenn.edu wrote:
  On Wed, Jun 19, 2013 at 11:11:16AM +0100, Francesco Mazzoli wrote:
  At Wed, 19 Jun 2013 10:03:27 + (UTC),
  AntC wrote:
   Hi Francesco, I think you'll find that the 'annoyance' is nothing to do
   with GADTs. I suggest you take the type signature off of foo1, and see
   what type ghc infers for it. It isn't :: a - Foo a - Int.
  
   [...]
  
   Yep, that message explains what's going on well enough for me.
 
  Did you read the rest of the code?  That ought to work, because GHC
  infers and uses the type equality (something like ‘v ~ Var v1’) and uses
  it to coerce the ‘x’.
 
  And, surprise surprise, if the argument order is switched, it works!
 
  data Foo v where
  Foo :: forall v. Foo (Maybe v)
 
  foo1 :: Foo a - a - Int
  foo1 Foo Nothing  = undefined
  foo1 Foo (Just x) = undefined
 
  Yes, I was going to suggest switching the argument order before
  reading your message.  This is an interesting way in which you can
  observe that Haskell does not really have multi-argument functions.
  All multi-argument functions are really one-argument functions which
  return functions.  So a function of type
 
foo1 :: a - (Foo a - Int)
 
  must take something of type a (for *any* choice of a, which the caller
  gets to choose) and return a function of type (Foo a - Int).  *Which*
  function is returned (e.g. one that tries to pattern match on the Foo)
  makes no difference to whether foo1 typechecks.
 
  On the other hand, a function of type
 
foo2 :: Foo a - (a - Int)
 
  receives something of type Foo a as an argument.  It may pattern-match
  on the Foo a, thus bringing into scope the fact that (a ~ Maybe v).
  Now when constructing the output function of type (a - Int) it may
  make use of this fact.
 
  -Brent
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 -- 
 Felipe.
 
 ___
 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] The promising world of Monadic formlets

2013-06-19 Thread Alberto G. Corona
Hi,

This is just to let you know the promising results of some experimentation:

Formlets are about applicative instances, but what about monadic instances?
What a Monad instance of formlets means? I recently experimented with this
and the results are very interesting and powerful- It mixes the best of web
forms, with the flexibility of console applications. ???!!


Althoug this example is for the formlets of the MFlow
https://github.com/agocorona/MFlowframework , it can be ported to other
formlet implementations. Although the MFLow formlets include web formatting
that is not supported in other formlets implementations. Static HTML
templating don´t work well with monadic formlets, so it is important to
include the formatting as a  part of the computation:

import MFlow.Wai.Blaze.Html.All

dynamicForm= wform $ do
  (n,s) - (,) - p  Who are you?
   ++ getString Nothing  ! hint name ++ br
   * getString Nothing  ! hint surname  ++ br
   ** submitButton ok ++ br

  flag - b  do you  ++ getRadio[radiob work?,radiob study?]
++ br

  r-case flag of
 work - pageFlow l
 $ Left  - b  do you enjoy your work? 
++ getBool True yes no
** submitButton ok  ++ br

 study- pageFlow r
 $ Right - b  do you study in 
  ++ getRadio[radiob University
 ,radiob High School]

  p  (You are ++n++ ++s) ++
   case r of
 Left fl -   p  (You work and it is  ++ show fl ++  that you
enjoy your work)
++ noWidget

 Right stu - p  (You study at the  ++ stu)
++ noWidget


hint s= [(placeholder,s)]
onClickSubmit= [(onclick,this.form.submit())]
radiob s n= text s ++ setRadio s n ! onClickSubmit

Here wform, getBool, getString , getRadio etc are formlet elements

The first sentence is an applicative composition that generate a 2 tuple,
to show that applicative and monadic can be mixed.  the operations ++ add
html to the formlet. the operatior ! add attributes to the formlet
element.. noWidget is a dumb formlet that does not validate.

The second monadic statement is an election between two options. The beauty
of the monadic instance is that the rest of the form can vary depending on
the previous answers.  Since the formlets validate the input, unless the
election is made, the radio will not validate, so the monadic
execution will be aborted beyond any unanswered question, so nothing will
appear after the question. The rest of the form will appear when the user
choose one of the two options. once one or the other option is chosen, then
another binary question is presented. (either he likes his work or where he
study).  When the questions are finised, the results are presented.
I hope that you get the idea. The benefit is not only the familiar coding
and presentation of a sequential console application: Since the form
encloses all the fields, At any time the user can change previous inputs
and the form will reflect these changes. For example if the user change
from work to study (second statements) the where do you study will appear
and the work related questions and answers will disappear. That is
wonderfully useful for heavily interactive applications.

There is  a problem however and it is the issue of the formlet identifiers.
Unlike in an applicative presentation, now the number and type of the
formlets will vary, so the response to a previous form create a new kind
of form, and the post response can be misinterpreted. To avoid that ,
the  pageFlow call creates fixed field labels for each branch of execution.

I will release a version of MFlow that support this kind of monadic
composition of fomlets, but In essence it is nothing but to add Monad
instance to formlets. A single server procedure, that executes the formlet
code can support all the interaction so any framework can do it. The
usability of that is huge:It is possible to interact in a web page in a
console style with questions and answers with the versatitly of a dynamic
foms: Any modification in the form change the subsequent flow of
interaction. Another application of this monadic style is to ease multistep
processes such are registration, check-out and payment ad so on. Even a
entire interactive dynamic application can be coded in a single page.

And no javascript is needed!.


To run this formlet in MFlow:

main=do
  addMessageFlows
   [(, transient $ runFlow  $ ask dynamicForm )]

   wait $ run port waiMessageFlow


This video show how the presentation of this example vary with the user
input:

http://youtu.be/DryBQc9agFg


I hope that you find the idea interesting.  If you want to experiment
with this in MFlow, I have to say that the implementation of this feature
is in an early stage. The code is in the head branch


Re: [Haskell-cafe] The promising world of Monadic formlets

2013-06-19 Thread Alberto G. Corona
I don´t know how, but the google mail has changed the applicative functor
operator after (,) Left and Rigth by  -.




2013/6/19 Alberto G. Corona agocor...@gmail.com

 Hi,

 This is just to let you know the promising results of some experimentation:

 Formlets are about applicative instances, but what about monadic
 instances? What a Monad instance of formlets means? I recently experimented
 with this and the results are very interesting and powerful- It mixes the
 best of web forms, with the flexibility of console applications. ???!!


 Althoug this example is for the formlets of the MFlow
 https://github.com/agocorona/MFlowframework , it can be ported to other
 formlet implementations. Although the MFLow formlets include web formatting
 that is not supported in other formlets implementations. Static HTML
 templating don´t work well with monadic formlets, so it is important to
 include the formatting as a  part of the computation:

 import MFlow.Wai.Blaze.Html.All

 dynamicForm= wform $ do
   (n,s) - (,) - p  Who are you?
++ getString Nothing  ! hint name ++ br
* getString Nothing  ! hint surname  ++ br
** submitButton ok ++ br

   flag - b  do you  ++ getRadio[radiob work?,radiob study?]
 ++ br

   r-case flag of
  work - pageFlow l
  $ Left  - b  do you enjoy your work? 
 ++ getBool True yes no
 ** submitButton ok  ++ br

  study- pageFlow r
  $ Right - b  do you study in 
   ++ getRadio[radiob University
  ,radiob High School]

   p  (You are ++n++ ++s) ++
case r of
  Left fl -   p  (You work and it is  ++ show fl ++  that you
 enjoy your work)
 ++ noWidget

  Right stu - p  (You study at the  ++ stu)
 ++ noWidget


 hint s= [(placeholder,s)]
 onClickSubmit= [(onclick,this.form.submit())]
 radiob s n= text s ++ setRadio s n ! onClickSubmit

 Here wform, getBool, getString , getRadio etc are formlet elements

 The first sentence is an applicative composition that generate a 2 tuple,
 to show that applicative and monadic can be mixed.  the operations ++ add
 html to the formlet. the operatior ! add attributes to the formlet
 element.. noWidget is a dumb formlet that does not validate.

 The second monadic statement is an election between two options. The
 beauty of the monadic instance is that the rest of the form can vary
 depending on the previous answers.  Since the formlets validate the input,
 unless the election is made, the radio will not validate, so the monadic
 execution will be aborted beyond any unanswered question, so nothing will
 appear after the question. The rest of the form will appear when the user
 choose one of the two options. once one or the other option is chosen, then
 another binary question is presented. (either he likes his work or where he
 study).  When the questions are finised, the results are presented.
 I hope that you get the idea. The benefit is not only the familiar coding
 and presentation of a sequential console application: Since the form
 encloses all the fields, At any time the user can change previous inputs
 and the form will reflect these changes. For example if the user change
 from work to study (second statements) the where do you study will appear
 and the work related questions and answers will disappear. That is
 wonderfully useful for heavily interactive applications.

 There is  a problem however and it is the issue of the formlet
 identifiers. Unlike in an applicative presentation, now the number and type
 of the formlets will vary, so the response to a previous form create a new
 kind of form, and the post response can be misinterpreted. To avoid that ,
 the  pageFlow call creates fixed field labels for each branch of execution.

 I will release a version of MFlow that support this kind of monadic
 composition of fomlets, but In essence it is nothing but to add Monad
 instance to formlets. A single server procedure, that executes the formlet
 code can support all the interaction so any framework can do it. The
 usability of that is huge:It is possible to interact in a web page in a
 console style with questions and answers with the versatitly of a dynamic
 foms: Any modification in the form change the subsequent flow of
 interaction. Another application of this monadic style is to ease multistep
 processes such are registration, check-out and payment ad so on. Even a
 entire interactive dynamic application can be coded in a single page.

 And no javascript is needed!.


 To run this formlet in MFlow:

 main=do
   addMessageFlows
[(, transient $ runFlow  $ ask dynamicForm )]

wait $ run port waiMessageFlow


 This video show how the presentation of this example vary with the user
 input:

 

[Haskell-cafe] TH clause Pat selection

2013-06-19 Thread Brian Lewis
I want to use TH to generate functions like
foo :: c - h
foo ... = ...
foo ... = ...
...
from lists of pairs :: [(c, h)]

For example, $(genFoo ''Int ''Bool [(0,False), (1,True)])
would generate
foo 0 = False
foo 1 = True

The problem is, I don't know how to generate the function's clauses.
foo 0 = ... seems to be a LitP pattern. But foo True = ... seems to
be a ConP pattern. The appropriate pattern depends on type c.

Here's code with more explanation and examples:
http://hpaste.org/90163

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


[Haskell-cafe] Installling Leksah on ghc7.6.3 with haskell-platform 2013?

2013-06-19 Thread Carlo Hamalainen

Hi,

I'm trying to install Leksah from hackage on my Debian testing laptop, 
which has ghc 7.6.3 and the Haskell Platform 2013. I fixed a bunch of 
errors about catch not being exported from the Prelude, but now I'm 
stuck on these two errors in leksah-server-0.8.0.5:


[10 of 13] Compiling IDE.Utils.GHCUtils ( src/IDE/Utils/GHCUtils.hs, 
dist/build/IDE/Utils/GHCUtils.o )


src/IDE/Utils/GHCUtils.hs:94:40-62:
Not in scope: data constructor `Opt_ReadUserPackageConf'

src/IDE/Utils/GHCUtils.hs:161:44-50:
Not in scope: data constructor `Opt_Cpp'
Perhaps you meant one of these:
  `Opt_CSE' (imported from GHC), `Opt_Pp' (imported from GHC)



Where have Opt_ReadUserPackageConf and Opt_Cpp gone in ghc 7.6.3?

Cheers,

-- Carlo

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