Re: [Haskell-cafe] Type checking oddity -- maybe my own confusion

2011-07-13 Thread oleg

Ryan Newton wrote:
 The desired goal was that everywhere I construct a value using the Assign
 constructor, that the resulting value's type to be tainted by the AssignCap
 constraint.

Your code essentially accomplishes the goal:

 data E m where
   Assign  :: AssignCap m = V - E m - E m - E m
   Varref  :: V - E m
 -- ...

Every time you construct the value of the type (E m) with the Assign
constructor, you have to constructively prove -- provide evidence for
-- that the type m is a member of AssignCap. That evidence is stored
within the E m value and so can be reused whenever it is needed later.

Let us modify the example slightly:

 class AssignCap m
 class MutateCap m

 data E m where
   Assign  :: AssignCap m = V - E m - E m - E m
   Mutate  :: MutateCap m = V - E m - E m - E m
   Varref  :: V - E m
 -- ...

 type V = String

 -- test1 :: E t - E t
 test1 (Assign v x1 x2) = Assign v x1 x2

 -- test2 :: MutateCap t = E t - E t
 test2 (Assign v x1 x2) = Mutate v x1 x2

To use the constructor Assign, we need the evidence that AssignCap m
holds. The deconstructed value (Assign v x1 x2) provides such an
evidence (as a `hidden' field of the data type). Therefore, the
inferred type for test1 has no constraints. In contrast, in test2 nothing
provides Mutate with the evidence that MutateCap m holds. Therefore,
the inferred type has the MutateCap m constraint.


If storing the evidence is not desired, then one should use ordinary
ADT with smart constructors:

 -- Data constructors should not be exported
 data E1 m = Assign1 V (E1 m) (E1 m) | Varref1 V
 isAssign (Assign1 v x1 x2) = Just (v,x1,x2)
 isAssign _ = Nothing

 assign :: AssignCap m = V - E1 m - E1 m - E1 m
 assign = Assign1

 -- test3 :: AssignCap m = E1 m - E1 m
 test3 e | Just (v,x1,x2) - isAssign e = assign v x1 x2

OCaml has a so-called private constructors, which permit
deconstruction but prohibit construction. They are quite handy,
saving us trouble writing the views like isAssign.

 Actually... to go a bit further, I thought there was some way to arrange
 this so that, upon GHC type-checking the case statement, it would realize
 that certain cases are forbidden based on the type, and would consider the
 pattern match complete without them (or issue an error if they are present).

The key word in the phrase ``certain cases are forbidden based on the
type'' is _type_ -- rather than a type class. If you wish to use this
special GADT feature, you have to `invert' your design. Rather than
specifying what is _required_ to construct an (E m) value, you should
specify what is _provided_.

 data E2 m where
 Assign2 :: V - E2 m - E2 m - E2 IOT
 Varref2  :: V - E2 PureT

 test4 :: E2 IOT - E2 IOT
 test4 (Assign2 v x1 x2) = Assign2 v x1 x2
 test4 (Varref2 _) = undefined

The compiler complaints

Couldn't match type `IOT' with `PureT'
Inaccessible code in
  a pattern with constructor
Varref2 :: V - E2 PureT,
  in an equation for `test4'
In the pattern: Varref2 _
In an equation for `test4': test4 (Varref2 _) = undefined

as desired.

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


Re: [Haskell-cafe] Baffling Hackage build log

2011-07-13 Thread Stephen Tetley
This seems to be a general problem with the Hackage server as other
packages uploaded after yours have failed to build with similar
errors...

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


[Haskell-cafe] Seeking Don Stewart

2011-07-13 Thread wren ng thornton
Hello all,

Sorry for the spam. I'm trying to get ahold of Don Stewart, but it looks
like there's some hiccup at Galois. When I mail him I get:

  d...@galois.com: host mail.galois.com[69.30.63.196] said: 550 5.1.1
  d...@galois.com... User unknown (in reply to RCPT TO command)

Does anyone know what's up, or if there's another (non-emergency) way to
get in touch with him?

-- 
Live well,
~wren



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


Re: [Haskell-cafe] Seeking Don Stewart

2011-07-13 Thread Michael Snoyman
Just post something on Stack Overflow, throw in a line about how
inefficient Haskell is compared with Java. It's like his bat signal.

Michael

On Wed, Jul 13, 2011 at 12:09 PM, wren ng thornton w...@freegeek.org wrote:
 Hello all,

 Sorry for the spam. I'm trying to get ahold of Don Stewart, but it looks
 like there's some hiccup at Galois. When I mail him I get:

  d...@galois.com: host mail.galois.com[69.30.63.196] said: 550 5.1.1
      d...@galois.com... User unknown (in reply to RCPT TO command)

 Does anyone know what's up, or if there's another (non-emergency) way to
 get in touch with him?

 --
 Live well,
 ~wren



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


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


Re: [Haskell-cafe] Seeking Don Stewart

2011-07-13 Thread Yves Parès
It's mine too!
Who!? Who said that? Links! I want links! (And names)

2011/7/13 Michael Snoyman mich...@snoyman.com

 Just post something on Stack Overflow, throw in a line about how
 inefficient Haskell is compared with Java. It's like his bat signal.

 Michael

 On Wed, Jul 13, 2011 at 12:09 PM, wren ng thornton w...@freegeek.org
 wrote:
  Hello all,
 
  Sorry for the spam. I'm trying to get ahold of Don Stewart, but it looks
  like there's some hiccup at Galois. When I mail him I get:
 
   d...@galois.com: host mail.galois.com[69.30.63.196] said: 550 5.1.1
   d...@galois.com... User unknown (in reply to RCPT TO command)
 
  Does anyone know what's up, or if there's another (non-emergency) way to
  get in touch with him?
 
  --
  Live well,
  ~wren
 
 
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 

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

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


Re: [Haskell-cafe] Seeking Don Stewart

2011-07-13 Thread Vo Minh Thu
Don isn't working at Galois anymore. I guess his new email address is
simple to find but I gave it to Wren privately.

But I guess the sloth signal works fine too.

Cheers,
Thu

2011/7/13 Yves Parès limestr...@gmail.com:
 It's mine too!
 Who!? Who said that? Links! I want links! (And names)

 2011/7/13 Michael Snoyman mich...@snoyman.com

 Just post something on Stack Overflow, throw in a line about how
 inefficient Haskell is compared with Java. It's like his bat signal.

 Michael

 On Wed, Jul 13, 2011 at 12:09 PM, wren ng thornton w...@freegeek.org
 wrote:
  Hello all,
 
  Sorry for the spam. I'm trying to get ahold of Don Stewart, but it looks
  like there's some hiccup at Galois. When I mail him I get:
 
   d...@galois.com: host mail.galois.com[69.30.63.196] said: 550 5.1.1
       d...@galois.com... User unknown (in reply to RCPT TO command)
 
  Does anyone know what's up, or if there's another (non-emergency) way to
  get in touch with him?
 
  --
  Live well,
  ~wren
 
 
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 

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


 ___
 Haskell-Cafe 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] Seeking Don Stewart

2011-07-13 Thread Erik de Castro Lopo
wren ng thornton wrote:

 Hello all,
 
 Sorry for the spam. I'm trying to get ahold of Don Stewart, but it looks
 like there's some hiccup at Galois. When I mail him I get:
 
   d...@galois.com: host mail.galois.com[69.30.63.196] said: 550 5.1.1
   d...@galois.com... User unknown (in reply to RCPT TO command)

Don recently left Galois and is now working for a bank in NYC.

Find him on google+.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/

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


Re: [Haskell-cafe] Baffling Hackage build log

2011-07-13 Thread Paterson, Ross
 This seems to be a general problem with the Hackage server as other
 packages uploaded after yours have failed to build with similar
 errors...

It seems one batch of builds was broken due to some failure in downloading
the package index.  I've re-run it.

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


[Haskell-cafe] Paid work available in functional web programming

2011-07-13 Thread Adam Chlipala
First, I apologize in advance if this post is deemed off-topic.  It's 
about Ur/Web, a statically typed, pure functional programming languages 
that is much influenced by Haskell.  For instance, Ur/Web includes 
monadic IO and type classes.


I write to mention briefly that I'm looking for people interested in 
writing Ur/Web programs for pay.  Ur/Web is a DSL for building modern 
web applications, and I believe it is truly a secret weapon for that 
domain, and one that should appeal to many Haskell fans.  I have one 
customer now for whom I'm leading a project to develop a particular web 
application, and I'd like to have more.  The current project would 
benefit from more programming help, and I would also like to develop a 
network of people interested in future projects.


More information on Ur/Web can be found here:
http://www.impredicative.com/ur/

So, are you interested in being paid at least market rates to develop 
real web applications in a cool Haskell-like language, thus helping to 
push functional programming further into the real world?


Might you have any leads for possible customers for this kind of work, 
possibly including start-ups that want to do in-house development using 
a cool language with close support from the language creator (which 
happens to be me!)?


I would love to receive reply e-mails with positive answers to either 
question!


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


Re: [Haskell-cafe] Seeking Don Stewart

2011-07-13 Thread Don Stewart
Hi everyone,

I'm working for Standard Chartered, based in New York (currently
though, I'm in Singapore).
You can reach me on this email.

Cheers,
   Don

On Wed, Jul 13, 2011 at 5:09 PM, wren ng thornton w...@freegeek.org wrote:
 Hello all,

 Sorry for the spam. I'm trying to get ahold of Don Stewart, but it looks
 like there's some hiccup at Galois. When I mail him I get:

  d...@galois.com: host mail.galois.com[69.30.63.196] said: 550 5.1.1
      d...@galois.com... User unknown (in reply to RCPT TO command)

 Does anyone know what's up, or if there's another (non-emergency) way to
 get in touch with him?

 --
 Live well,
 ~wren



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


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


Re: [Haskell-cafe] Paid work available in functional web programming

2011-07-13 Thread Christopher Done
On 13 July 2011 15:28, Adam Chlipala ad...@impredicative.com wrote:
 I write to mention briefly that I'm looking for people interested in writing
 Ur/Web programs for pay.  Ur/Web is a DSL for building modern web
 applications, and I believe it is truly a secret weapon for that domain, and
 one that should appeal to many Haskell fans.  I have one customer now for
 whom I'm leading a project to develop a particular web application, and I'd
 like to have more.  The current project would benefit from more programming
 help, and I would also like to develop a network of people interested in
 future projects.

 More information on Ur/Web can be found here:
    http://www.impredicative.com/ur/

I would like to see a real application in Ur/Web. There are many
simple examples. I don't and wouldn't want to develop like that,
writing raw HTML and SQL seems going backwards despite the incredible
advances in consistency and correctness that Ur/Web offers. I also
find it hard to understand the type system in a non-superficial level
because the related paper was very hard to grok. I tried to get it
running a while ago and could not get it to compile. I would also like
to see how it handles non-web stuff as inevitably IME web applications
involve more than merely reading and writing to a database.

I like the idea, please keep us posted about it.

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


Re: [Haskell-cafe] Paid work available in functional web programming

2011-07-13 Thread Yves Parès
It'd also be interesting to know what you missed in Haskell web development
so that you needed to build a new language inspired from it.


2011/7/13 Christopher Done chrisd...@googlemail.com

 On 13 July 2011 15:28, Adam Chlipala ad...@impredicative.com wrote:
  I write to mention briefly that I'm looking for people interested in
 writing
  Ur/Web programs for pay.  Ur/Web is a DSL for building modern web
  applications, and I believe it is truly a secret weapon for that domain,
 and
  one that should appeal to many Haskell fans.  I have one customer now for
  whom I'm leading a project to develop a particular web application, and
 I'd
  like to have more.  The current project would benefit from more
 programming
  help, and I would also like to develop a network of people interested in
  future projects.
 
  More information on Ur/Web can be found here:
 http://www.impredicative.com/ur/

 I would like to see a real application in Ur/Web. There are many
 simple examples. I don't and wouldn't want to develop like that,
 writing raw HTML and SQL seems going backwards despite the incredible
 advances in consistency and correctness that Ur/Web offers. I also
 find it hard to understand the type system in a non-superficial level
 because the related paper was very hard to grok. I tried to get it
 running a while ago and could not get it to compile. I would also like
 to see how it handles non-web stuff as inevitably IME web applications
 involve more than merely reading and writing to a database.

 I like the idea, please keep us posted about it.

 ___
 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] Splitting Hackage Packages and re-exporting entire modules (with same module name)

2011-07-13 Thread Bertram Felgenhauer
Antoine Latter wrote:
 If you give the module a new name in the new package then the old
 module can re-export all of the symbols in the new module.
 
 In GHC I don't think there is a way for two packages to export the
 same module and have them be recognized as the same thing, as far as I
 know.

Right, but you don't have to rename the module if you use the
PackageImports extension. (Incidentally, this used by the haskell2010
ibrary, which is implemented in terms of base)

http://haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#package-imports

So the following should work, assuming 'original' is a package exporting
the Foo.Bar module.

  {-# LANGUAGE PackageImports #-}
  module Foo.Bar (module Original) where

  import original Foo.Bar as Original

Best regards,

Bertram

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


Re: [Haskell-cafe] Paid work available in functional web programming

2011-07-13 Thread Daniel Patterson
I also think it would be really good to have some documentation that explains 
the type system and how to do neat things with it in terms that a reasonably 
competent haskell / ML programmer could understand. 

I played around with Ur/Web about a year ago and was able to make a simple 
application, and use some C libraries (the C FFI is really easy to use), but 
realized that I wasn't able to do much of anything beyond mimicking the demos 
in various ways, mainly because the documentation was so sparse (when I didn't 
know how to do something, I just tried to do what I would expect it to do if it 
were haskell, which worked a surprising amount of the time, but wasn't the most 
enjoyable experience).

Looking at, for example, page 19 of the reference manual [1], which is supposed 
to explain how expressions are typed (which I would assume would give input 
into how the type system worked), I, probably like Chris, couldn't make much 
sense of it. Now I don't have a PhD in type theory, or even a masters degree, 
but if your intended audience includes people like me, the documentation 
definitely needs work! 

Now perhaps understanding those tables isn't actually important to using the 
language, but from looking through the manual / available documentation, there 
seems to be the really basic cookbook style stuff, that you can copy and paste 
and modify, as long as you are careful, then the source code itself, from which 
more can be gleaned, and then this type of type theory. Because of this (or 
until there is real documentation explaining some of the novel things about 
this language), I think Ur/Web is going to remain a cool thing that barely 
anyone can do anything with. Something to be linked in reddit or stack overflow 
posts, but not actually used! It seems like documentation of the really basic 
stuff is there, and the really advanced stuff (which is great, don't get me 
wrong), but the stuff in the middle is missing! Which is too bad, because it 
seems like it is doing some really exciting things.

1. http://www.impredicative.com/ur/manual.pdf

On Jul 13, 2011, at 11:10 AM, Christopher Done wrote:

 On 13 July 2011 15:28, Adam Chlipala ad...@impredicative.com wrote:
 I write to mention briefly that I'm looking for people interested in writing
 Ur/Web programs for pay.  Ur/Web is a DSL for building modern web
 applications, and I believe it is truly a secret weapon for that domain, and
 one that should appeal to many Haskell fans.  I have one customer now for
 whom I'm leading a project to develop a particular web application, and I'd
 like to have more.  The current project would benefit from more programming
 help, and I would also like to develop a network of people interested in
 future projects.
 
 More information on Ur/Web can be found here:
http://www.impredicative.com/ur/
 
 I would like to see a real application in Ur/Web. There are many
 simple examples. I don't and wouldn't want to develop like that,
 writing raw HTML and SQL seems going backwards despite the incredible
 advances in consistency and correctness that Ur/Web offers. I also
 find it hard to understand the type system in a non-superficial level
 because the related paper was very hard to grok. I tried to get it
 running a while ago and could not get it to compile. I would also like
 to see how it handles non-web stuff as inevitably IME web applications
 involve more than merely reading and writing to a database.
 
 I like the idea, please keep us posted about it.
 
 ___
 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] Splitting Hackage Packages and re-exporting entire modules (with same module name)

2011-07-13 Thread Antoine Latter
On Wed, Jul 13, 2011 at 10:31 AM, Bertram Felgenhauer
bertram.felgenha...@googlemail.com wrote:
 Antoine Latter wrote:
 If you give the module a new name in the new package then the old
 module can re-export all of the symbols in the new module.

 In GHC I don't think there is a way for two packages to export the
 same module and have them be recognized as the same thing, as far as I
 know.

 Right, but you don't have to rename the module if you use the
 PackageImports extension. (Incidentally, this used by the haskell2010
 ibrary, which is implemented in terms of base)

 http://haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#package-imports

 So the following should work, assuming 'original' is a package exporting
 the Foo.Bar module.

  {-# LANGUAGE PackageImports #-}
  module Foo.Bar (module Original) where

  import original Foo.Bar as Original

 Best regards,

 Bertram


The downside to this approach is that anyone trying to use the module
in GHCi (or use the module in a non-Cabal setting) will need to
manually hide one of the packages.

Does anyone know if there is a way to make Cabal auto-hide a package
after install without too much trickery? That might be more than you
want to do.

Antoine

 ___
 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] Paid work available in functional web programming

2011-07-13 Thread Ertugrul Soeylemez
Christopher Done chrisd...@googlemail.com wrote:

  I write to mention briefly that I'm looking for people interested in
  writing Ur/Web programs for pay.  Ur/Web is a DSL for building
  modern web applications, and I believe it is truly a secret weapon
  for that domain, and one that should appeal to many Haskell fans.  I
  have one customer now for whom I'm leading a project to develop a
  particular web application, and I'd like to have more.  The current
  project would benefit from more programming help, and I would also
  like to develop a network of people interested in future projects.

 I would like to see a real application in Ur/Web. There are many
 simple examples. I don't and wouldn't want to develop like that,
 writing raw HTML and SQL seems going backwards despite the incredible
 advances in consistency and correctness that Ur/Web offers.

I agree about the HTML part, but not so much about the SQL part.
Personally I went back from all the nice abstractions to writing raw
SQL, because I realized that this is the only way to really exploit the
power of my database system (PostgreSQL) [1].

[1] http://coder.mx/journal/yesod-persistent-vs-sql


 I also find it hard to understand the type system in a non-superficial
 level because the related paper was very hard to grok. I tried to get
 it running a while ago and could not get it to compile. I would also
 like to see how it handles non-web stuff as inevitably IME web
 applications involve more than merely reading and writing to a
 database.

 I like the idea, please keep us posted about it.

I like the continuation part about it.  If there were a web framework in
Haskell similar to the continuation-based framework in Racket or Ur/Web,
I would most certainly switch to it (from Yesod), given that it's mature
enough.


Greets,
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife = sex)
http://ertes.de/



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


Re: [Haskell-cafe] ANN: fix-imports-0.1.2

2011-07-13 Thread Henning Thielemann

On 12.07.2011 09:59, Evan Laforge wrote:

I meant more in the Before: ... After: ... sense ;-) (i.e. visually
being able to tell what your program does, rather than just a
description).


Oh, ok, I guess I can do that too:

Before:

module M where
import ZZ.Out.Of.Order
import qualified No.Longer.Needed as Needed

-- x = Needed.y -- just removed this
y = New.something -- just added this

After:

module M where
import qualified Heavily.Nested.New as New
import ZZ.Out.Of.Order

-- x = Needed.y -- just removed this
y = New.something -- just added this



I also spend some time on managing imports. I'll try this program. 
However, usually I have a mix of qualified and unqualified imports, 
since some libraries are designed for unqualified imports.


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


Re: [Haskell-cafe] ANN: fix-imports-0.1.2

2011-07-13 Thread Evan Laforge
On Wed, Jul 13, 2011 at 12:08 PM, Henning Thielemann
schlepp...@henning-thielemann.de wrote:
 I also spend some time on managing imports. I'll try this program. However,
 usually I have a mix of qualified and unqualified imports, since some
 libraries are designed for unqualified imports.

You can still use unqualified imports, it just won't manage those for
you.  Automatically managing unqualified imports is solvable but
harder.

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


Re: [Haskell-cafe] Paid work available in functional web programming

2011-07-13 Thread Adam Chlipala

Christopher Done wrote:

I also find it hard to understand the type system in a non-superficial level
because the related paper was very hard to grok.


I'll only claim it's a fairly breezy read for people familiar with 
dependent type theory, which admittedly is not a huge crowd, even as a 
proportion of the Haskell community.  More accessible documentation of 
that aspect is on my to-do list.  I'm more or less waiting to start it 
until I get this current commercial project staffed properly.


I know it _is_ possible to learn the interesting type system features 
well enough with just the existing documentation, because one programmer 
on the project, who has no CS research background, has managed to do it 
without much apparent trouble.



I tried to get it
running a while ago and could not get it to compile.


You couldn't get the compiler to compile?  No one has reported problems 
recently, so I suspect everything would Just Work today, if you're using 
Linux or OS X (and possibly in other cases).



I would also like
to see how it handles non-web stuff as inevitably IME web applications
involve more than merely reading and writing to a database.
   


I have no near-term plans to build an Ur implementation that handles 
non-web applications.  There is an FFI, though.


Yves_Pares wrote:
It'd also be interesting to know what you missed in Haskell web 
development so that you needed to build a new language inspired from it.


The key piece is precisely the basis of my paper Ur: Statically-Typed 
Metaprogramming with Type-Level Record Computation.  Haskell is missing 
the features that I think are critical for pleasant type-level 
computation, in particular of the variety that I use in the examples 
detailed in the paper.  I'll leave the rest of my argument to be read 
out of the paper by those with enough background to do so.  Folks 
without that background might at least read the case studies part of the 
paper and consider how such things might be implemented in Haskell, with 
equivalent or stronger static guarantees.


Ertugrul Soeylemez wrote:

Christopher Donechrisd...@googlemail.com  wrote:

   

I write to mention briefly that I'm looking for people interested in
writing Ur/Web programs for pay.  Ur/Web is a DSL for building
modern web applications, and I believe it is truly a secret weapon
for that domain, and one that should appeal to many Haskell fans.  I
have one customer now for whom I'm leading a project to develop a
particular web application, and I'd like to have more.  The current
project would benefit from more programming help, and I would also
like to develop a network of people interested in future projects.
   


  I would like to see a real application in Ur/Web. There are many
  simple examples. I don't and wouldn't want to develop like that,
  writing raw HTML and SQL seems going backwards despite the incredible
  advances in consistency and correctness that Ur/Web offers.
 

I agree about the HTML part, but not so much about the SQL part.
Personally I went back from all the nice abstractions to writing raw
SQL, because I realized that this is the only way to really exploit the
power of my database system (PostgreSQL) [1].
   


I agree.  I find that SQL is the most natural language for expressing 
data reading and writing, at least for the web applications I write.  
The need to go through a less declarative interface (e.g., classic ORMs) 
would be a bug, not a feature, for me.  (Though the online Ur/Web demos 
include type-safe ORM implemented as a library completely within the 
language!)


As far as HTML templating goes, templates are easy to implement as 
functions within Ur.  I understand that people unfamiliar with the 
language will want to see code examples before accepting this, but 
unfortunately I have none now.


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


[Haskell-cafe] [iteratee] empty chunk as special case of input

2011-07-13 Thread Sergey Mironov
Hi community, hi John. I find myself reading bindIteratee[1] function
for a several days.. there is something that keeps me away from
completely understanding of the concept. The most noticeble thing is
\nullC\ guard in the definition. To demonstate the consequences of
this solution, let me define an iterator like

myI = Iteratee $ \onDone _ - onDone 'a' (Chunk xyz)

It is a bit unusial, since myI substitutes real stream with a fake one
(xyz). Now lets define two actions producing different results in
unusual manner:

printI i = enumPure1Chunk ['a'..'g'] i = run = print

i1 = (return 'b'  myI  I.head)  -- myI substitutes the stream,
last /I.head/ produces 'x', OK
i2 = (I.head  myI  I.head) -- produces 'b'!  I expected another
'x' here but myI's stream was ignored by =

Well, I understand that this is probably an expected behaviour, but
what is it for? Why we can't handle null input like non-null? Iterator
may just stay in it's current state in that case.

Thanks in advance
Sergey

--
[1] - bindIteratee (basically, =) code from Data.Iteratee.Base.hs

bindIteratee :: (Monad m, Nullable s)
= Iteratee s m a
- (a - Iteratee s m b)
- Iteratee s m b
bindIteratee = self
where
self m f = Iteratee $ \onDone onCont -
 let m_done a (Chunk s)
   | nullC s  = runIter (f a) onDone onCont
 m_done a stream = runIter (f a) (const . flip onDone
stream) f_cont
   where f_cont k Nothing = runIter (k stream) onDone onCont
 f_cont k e   = onCont k e
 in runIter m m_done (onCont . (flip self f .))

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


Re: [Haskell-cafe] ANN: fix-imports-0.1.2

2011-07-13 Thread Markus Läll
I have used it a little and it worked quite nicely.

One thing that to look out for though is that it first checks for
modules from the current directory down -- so running it in somewhere
you happen to have ghc sources too, will have all that come with it
imported from there (and lines like import path.to.ghc.DataMaybe
(fromJust) added). But this probably happens only when testing the
program in the root of your home directory...

(The reason I'm not using it regularly is that I haven't figured out a
good way to use it, when developing with Notepad++ over sftp in
another environment)


-- 
Markus Läll

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


Re: [Haskell-cafe] ANN: fix-imports-0.1.2

2011-07-13 Thread Evan Laforge
On Wed, Jul 13, 2011 at 3:05 PM, Markus Läll markus.l...@gmail.com wrote:
 One thing that to look out for though is that it first checks for
 modules from the current directory down -- so running it in somewhere
 you happen to have ghc sources too, will have all that come with it
 imported from there (and lines like import path.to.ghc.DataMaybe
 (fromJust) added). But this probably happens only when testing the
 program in the root of your home directory...

Yeah, currently the most annoying thing is when it guesses wrong.
It's set up to work with my project, but you can tweak the search
heuristic easily enough by editing findLocalModule.  I'll have it skip
non-capitalized directories, but a better solution is to not edit
modules in your home directory :)

 (The reason I'm not using it regularly is that I haven't figured out a
 good way to use it, when developing with Notepad++ over sftp in
 another environment)

Well, if anyone makes bindings for other editors, feel free to send a patch.

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


Re: [Haskell-cafe] [iteratee] empty chunk as special case of input

2011-07-13 Thread John Lato
Hi Sergey,

iteratee (the package) uses a null chunk to signify that no further
stream data is available within the iteratee, that is, at some point
the stream has been entirely consumed.  Therefore, if any of the
composed iteratees haven't run to completion, they need to get more
data from an enumerator.  Thus 'bindIteratee' has the nullC guard in
the definition as an optimization; there's no need to send the null
chunk to bound iteratees because in most cases they won't be able to
do anything with it.

I've recently considered removing this, but at present when I take it
out some unit tests fail and I haven't had time to explore further.
Since this would have other benefits I would like to do so provided it
doesn't strongly impact performance.  Rather than simply removing the
case I could add a null case to the Stream type, but that could cause
some extra work for users.

Also, one rule for writing iteratees is that they shouldn't put
elements into the stream.  Doing so may cause various transformers to
behave incorrectly.  If you want to modify a stream rather than simply
consuming elements, the correct approach is to create an enumeratee
(stream transformer).

John L.

On Wed, Jul 13, 2011 at 11:00 PM, Sergey Mironov ier...@gmail.com wrote:
 Hi community, hi John. I find myself reading bindIteratee[1] function
 for a several days.. there is something that keeps me away from
 completely understanding of the concept. The most noticeble thing is
 \nullC\ guard in the definition. To demonstate the consequences of
 this solution, let me define an iterator like

 myI = Iteratee $ \onDone _ - onDone 'a' (Chunk xyz)

 It is a bit unusial, since myI substitutes real stream with a fake one
 (xyz). Now lets define two actions producing different results in
 unusual manner:

 printI i = enumPure1Chunk ['a'..'g'] i = run = print

 i1 = (return 'b'  myI  I.head)  -- myI substitutes the stream,
 last /I.head/ produces 'x', OK
 i2 = (I.head  myI  I.head) -- produces 'b'!  I expected another
 'x' here but myI's stream was ignored by =

 Well, I understand that this is probably an expected behaviour, but
 what is it for? Why we can't handle null input like non-null? Iterator
 may just stay in it's current state in that case.

 Thanks in advance
 Sergey

 --
 [1] - bindIteratee (basically, =) code from Data.Iteratee.Base.hs

 bindIteratee :: (Monad m, Nullable s)
    = Iteratee s m a
    - (a - Iteratee s m b)
    - Iteratee s m b
 bindIteratee = self
    where
        self m f = Iteratee $ \onDone onCont -
             let m_done a (Chunk s)
                   | nullC s      = runIter (f a) onDone onCont
                 m_done a stream = runIter (f a) (const . flip onDone
 stream) f_cont
                   where f_cont k Nothing = runIter (k stream) onDone onCont
                         f_cont k e       = onCont k e
             in runIter m m_done (onCont . (flip self f .))


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


Re: [Haskell-cafe] [iteratee] empty chunk as special case of input

2011-07-13 Thread John Lato
Sorry for the followup, but I forgot about one other important reason
(probably the real reason) for the nullC case in bindIteratee.  Note
what happens in the regular case: the iteratee is run, and if it's in
a completed state, the result is passed to the bound function (in the
m_done line), which is then also run.  Examine what happens if the
inner iteratee is also complete:

 const . flip onDone stream

which would be more clearly written as

 \b _str - onDone b stream

so in this case the leftover stream result from the first iteratee
(stream) is used as the result of the second iteratee, and the
leftover stream from the second iteratee (_str) is discarded.

This doesn't seem right; what should happen is that the two streams
should be appended somehow.  It works because at this stage an
iteratee won't have been enumerated over (by the current stream at
least), so it can't have any leftover data, just a null chunk.  But
bindIteratee explicitly checks for the null chunk case also so that's
not a problem.  If the iteratee was enumerated over by another stream
and therefore does have leftover data, then since that data isn't part
of the current stream it's rightfully discarded anyway.

This is why your function produced an unexpected result; it's in a
completed state without having been enumerated over, but also has
leftover data, which bindIteratee ignores.

Now that I've thought about it, I'm not convinced this is always
correct; in particular I suspect it for being responsible for a
slightly convoluted implementation of enumFromCallbackCatch.  I'll
have to expend more brain cells on it, I think.

John L.

On Thu, Jul 14, 2011 at 1:15 AM, John Lato jwl...@gmail.com wrote:
 Hi Sergey,

 iteratee (the package) uses a null chunk to signify that no further
 stream data is available within the iteratee, that is, at some point
 the stream has been entirely consumed.  Therefore, if any of the
 composed iteratees haven't run to completion, they need to get more
 data from an enumerator.  Thus 'bindIteratee' has the nullC guard in
 the definition as an optimization; there's no need to send the null
 chunk to bound iteratees because in most cases they won't be able to
 do anything with it.

 I've recently considered removing this, but at present when I take it
 out some unit tests fail and I haven't had time to explore further.
 Since this would have other benefits I would like to do so provided it
 doesn't strongly impact performance.  Rather than simply removing the
 case I could add a null case to the Stream type, but that could cause
 some extra work for users.

 Also, one rule for writing iteratees is that they shouldn't put
 elements into the stream.  Doing so may cause various transformers to
 behave incorrectly.  If you want to modify a stream rather than simply
 consuming elements, the correct approach is to create an enumeratee
 (stream transformer).

 John L.

 On Wed, Jul 13, 2011 at 11:00 PM, Sergey Mironov ier...@gmail.com wrote:
 Hi community, hi John. I find myself reading bindIteratee[1] function
 for a several days.. there is something that keeps me away from
 completely understanding of the concept. The most noticeble thing is
 \nullC\ guard in the definition. To demonstate the consequences of
 this solution, let me define an iterator like

 myI = Iteratee $ \onDone _ - onDone 'a' (Chunk xyz)

 It is a bit unusial, since myI substitutes real stream with a fake one
 (xyz). Now lets define two actions producing different results in
 unusual manner:

 printI i = enumPure1Chunk ['a'..'g'] i = run = print

 i1 = (return 'b'  myI  I.head)  -- myI substitutes the stream,
 last /I.head/ produces 'x', OK
 i2 = (I.head  myI  I.head) -- produces 'b'!  I expected another
 'x' here but myI's stream was ignored by =

 Well, I understand that this is probably an expected behaviour, but
 what is it for? Why we can't handle null input like non-null? Iterator
 may just stay in it's current state in that case.

 Thanks in advance
 Sergey

 --
 [1] - bindIteratee (basically, =) code from Data.Iteratee.Base.hs

 bindIteratee :: (Monad m, Nullable s)
    = Iteratee s m a
    - (a - Iteratee s m b)
    - Iteratee s m b
 bindIteratee = self
    where
        self m f = Iteratee $ \onDone onCont -
             let m_done a (Chunk s)
                   | nullC s      = runIter (f a) onDone onCont
                 m_done a stream = runIter (f a) (const . flip onDone
 stream) f_cont
                   where f_cont k Nothing = runIter (k stream) onDone onCont
                         f_cont k e       = onCont k e
             in runIter m m_done (onCont . (flip self f .))



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