Re: [Ur] Drop of several orders of magnitude in Techempower benchmarks

2019-08-11 Thread Karn Kallio

> Hello! I used "git bisect" to find the commit that introduced
> behaviour that causes Ur/Web to fail the Fortunes test in the
> benchmarks. It's commit 5cc729b48aad084757a049b7e5cdbadae5e9e400 from
> November 2018. Unfortunately that's a pretty big squashed commit from
> a PR:
> https://github.com/urweb/urweb/commit/5cc729b48aad084757a049b7e5cdbadae5e9e400
> 
> It'd be great if someone could take a look and see why it strips UTF-8
> output in that benchmark test. Note that the test runs in a Docker
> container, so perhaps it's trying to infer a system-wide i18n setting?
> 
> Once we fix this, we can update the benchmarks repo and solve the
> sorry state of affairs with Ur/Web way down the performance rankings.
> I'd love to see more people active in the community, and things like
> this would help raise awareness of the project.
> 
> Oisín
> 

I suspect this has to do with the difference between LTR and RTL
languages.  A given database, in the fortunes table, may have Arabic
text stored "backwards", and without any markings such as U+200F
RIGHT-TO-LEFT MARK and so the U8_NEXT macro is seeing a trailing byte
of a UTF-8 encoded character and failing to loop.

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


[Ur] The right way to do federated login in 2015?

2015-10-21 Thread Karn Kallio
I don't think it is in use today, but an idea for a federated login that does 
not reveal usage information to the authentication service is SPRESSO, 
described here: http://arxiv.org/pdf/1508.01719.pdf



___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] rpc calls from signals?

2013-03-11 Thread Karn Kallio

I think the GUI library has something that might suit your case.  The 
sourceL.ur and sourceL.urs listed here:

http://hg.impredicative.com/gui/file/d32fb0f7b137

I think implement the change listener Adam mentioned.



 I was kind of expecting that, but I do think it is a common thing and
 so probably useful to support in some way (though probably best done
 somewhat separately).
 
 The main reason I wanted to have them connected is to re-use the
 runtime checks that are looking for changes - having a check running
 every N milliseconds seems really pointless when the javascript
 runtime already knows when values are changing.
 
 Would there be a way to set up an event listener for changes on a
 source? I can obviously create a changed source for each source I
 have, and then flip it on when the source changes, and off in the
 thread that is making rpc calls, but ideally that thread wouldn't even
 be woken up unless the change had happened. Though maybe I'm bean
 counting given how fast even phones are these days... (and indeed I'm
 only concerned about phones, and primarily for the sake of battery
 life, not responsiveness).
 
 On Mon, Mar 11, 2013 at 10:47 AM, Adam Chlipala ad...@csail.mit.edu wrote:
  On 03/11/2013 10:20 AM, Daniel Patterson wrote:
  Is there a way to call remote procedures in signal handlers? I looked
  through the manual and basis.urs and couldn't find anything.
  
  The use case isn't particularly strange: I want to persist client side
  changes on the server, ideally only making rpc calls when something
  actually changes. I can spawn a thread that checks periodically if the
  value has changed (that's what I ended up hacking together), but at that
  point I'm replicating imperatively what FRP is supposed to eliminate!
  
  I would actually consider it a bug if what you ask were possible!  The
  [signal] monad is meant to rule out side effects, and RPCs can cause
  arbitrary side effects, not just locally but out in the real world.  There
  would need to be some kind of type system, etc., to recognize RPCs that
  are
  suitably pure.  Imagine the consequences of the launch missile RPC
  running every time the runtime system decides that some DOM subtree needs
  recomputation. ;)
  
  Why not implement a general library for change listeners?  Certainly there
  is some duplication with FRP, but at the same time I would expect it's
  pretty straightforward to implement.  You could create a new abstract type
  that encapsulates a [source] plus change listeners.
 
 ___
 Ur mailing list
 Ur@impredicative.com
 http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] The future of [class] declarations

2012-07-27 Thread Karn Kallio
 
 Well, while Ur is full of undecidable type inference issues, I generally
 try to keep type _checking_ (of sufficiently annotated programs)
 decidable or at least predictable.  It seems hard to support predictable
 checking of same-module type class usage without requiring restrictions
 that don't apply elsewhere.  To explain:


If picking up the instances must lead to undecidable type checking then 
removing the class declaration seems very good to me.  Yet if the restrictions
you mention could be mild while still leaving type checking decidable and
allowing instance detection then maybe keeping the class declaration could be
considered.  What sort of restrictions would be required?
 
 When a type class is considered as an abstract type-level function, I
 believe it is decidable whether a particular type equals an application
 of the class.  However, when inference must be done where a type class's
 definition is exposed, I _think_ the problem is clearly undecidable,
 being an easy reduction target for the problem of higher-order
 unification.

So I guess a sufficient (but perhaps too onerous) restriction could be for the 
programmer to provide annotations showing which types are class applications?

Also, now that you are a professor, maybe you could put a student to showing
undecidability by working through your reduction!



___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] Request environment variables

2012-07-27 Thread Karn Kallio

 Hello all,
 
 Servers pass a lot of interesting information to the CGI
 programs in the form of environment variables (for example,
 if you do client cert authentication, that info comes in the
 form of an environment variable.)  It would be great if
 Ur/Web could access that information.
 
 Now, implementing this requires a little bit of cooperation
 from the SAPIs, since, for example, FastCGI passes in its
 environment variables from the wire, so just calling getenv
 doesn't work.  But probably a 'getenv : string - transaction string'
 would work reasonably well.
 
 Thoughts?
 

Maybe

type env_var_name = string
type env_var_content = string

val getenv : transaction (list (env_var_name * env_var_content))

to receive the complete environment at once?




___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] XHTML character entities

2011-11-16 Thread Karn Kallio
On Wednesday, November 16, 2011 08:10:57 AM Adam Chlipala wrote:
 James Parker wrote:
  Sorry for taking so long to get back to you. Yes, it now parses and
  compiles copy;. The only thing is Firefox 8 (OS X 10.7) adds an
  extra character before the copyright symbol. I have attached a
  screenshot.
 Weird.  Works fine in Chrome and Opera.  Right now, I'm compiling the
 character entities into normal UTF-8, but perhaps it's necessary to
 output them as character entities.  I'll look into it soon.  Thanks for
 the bug report!
 

Attached patch including the character encoding with the response mime type 
seems to work for Firefox.


 ___
 Ur mailing list
 Ur@impredicative.com
 http://www.impredicative.com/cgi-bin/mailman/listinfo/ur# HG changeset patch
# User Karn Kallio kkallio@eka
# Date 1321467682 16200
# Node ID 3e24c24a25004b5f8d73ee964d8b815a675ba091
# Parent  7862f89674b909575a00c81c0d54a3acc367cafb
Include character encoding in HTTP response headers.

diff -r 7862f89674b9 -r 3e24c24a2500 src/cjr_print.sml
--- a/src/cjr_print.sml	Mon Nov 14 11:56:30 2011 -0430
+++ b/src/cjr_print.sml	Wed Nov 16 13:51:22 2011 -0430
@@ -2814,7 +2814,7 @@
  box (case ek of
   Core.Rpc _ = [string uw_write_header(ctx, \Content-type: text/plain\\r\\n\);,
  newline]
-| _ = [string uw_write_header(ctx, \Content-type: text/html\\r\\n\);,
+| _ = [string uw_write_header(ctx, \Content-type: text/html; charset=utf-8\\r\\n\);,
 newline,
 string uw_write_header(ctx, \Content-script-type: text/javascript\\r\\n\);,
 newline,
___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] Abstract type for 'id' attributes?

2011-08-30 Thread Karn Kallio
On Tuesday, August 30, 2011 06:45:10 PM Adam Chlipala wrote:
 Currently, Ur/Web supports an 'id' attribute on any XML element.  I
 added this when someone requested support for the label tag.
 
 Currently, 'id' attributes have type [string].  This freaks me out
 somewhat, since it's anti-modular; different functions written by
 different people might need to coordinate to avoid duplicating IDs.  The
 use of IDs is convenient for FFI JavaScript code that wants to get
 handles to DOM nodes.
 
 So, I'm thinking of adding an abstract type of IDs, with only one
 built-in operation: generate fresh ID.  Every tag's 'id' attribute
 would change to take a value of this type.  Under the hood, these would
 just be strings, making for easy FFI integration.
 
 Does anyone object to the idea?  Any other feedback?

No objection, I think it is a good idea.  For integration with external CSS 
and FFI Ecmascript, would it be possible to have a second operation that takes 
a suggestion string and generates an id having that as the under the hood 
value if it is not already taken?  Already taken suggestions then cause an 
error if given again, or alternatively are ignored or modified.  Without some 
sort of mechanism for controlling or mapping id string values I think it will 
generally be impossible to use external resources (eg style sheets on another 
server or under control of some other team).

 
 ___
 Ur mailing list
 Ur@impredicative.com
 http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] hiccups with tutorial ...

2011-07-17 Thread Karn Kallio
 Hello ur group,
 
I am running Linux Komputer 2.6.32-33-generic #70-Ubuntu SMP Thu Jul 7
 
 21:09:46 UTC 2011 i686 GNU/Linux . I upgraded my system, e.g. sudo
 apt-get install  postgresql. But got below . ??
 

With Debian/Ubuntu it may be necessary to install a package called postgresql-
dev or similar.  This is a guess, I do not in fact know if that is a solution.

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] Weird behavior with dyn tags in recursive call

2011-05-10 Thread Karn Kallio
 I was trying to modify the tree example to be a collapsing tree and when
 this renders the javascript ends up getting spewed out all over the
 form. It looks like it's getting escaped or something.

If I understand correctly, any dyn xml which must be spliced into the document 
at program execution time will be escaped ... only dyn tags which are spliced 
in at compile time will work.  So any dyn tags whose inclusion depends on the 
execution environment (like in your case the database state) will be escaped.  
I don't think the difficulty is related to recursive calls.


___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] A direction for Ur/Web

2011-03-27 Thread Karn Kallio
  Well, some similar fuzzy brainstorming that has occurred to me before:
  To have safely tweakable themes Ur/Web could represent them as types in
  some way.  That probably means Ur/Web will have to represent CSS too. 
  To naturally support user changes of themes at run time then probably
  implies that Ur/Web will need more support for dependent types, to allow
  expressions of a theme type depending on a value coming from a user.
 
 Why is linking to an alternate style sheet not enough to effect such a
 change?  This is completely supported even in the most recent official
 Ur/Web release.
 

I assume safely tweakable themes require some sort of guarantee that there is 
at least a minimum level of correspondence between the CSS and the XHTML.  The 
current mechanism of linking to a style sheet provides no guarantees on the 
CSS content of that style sheet; indeed, the style sheet may not even contain 
valid CSS.  Of course Ur/Web supports theming, but I don't think it currently 
supports *safe* theming.  Control of CSS class attributes via style helps but 
leaves too much underspecified to be safe (in my opinion).

 If you want any more than this, then major changes to the
 language/compiler would be required, since the present support is based
 essentially on whole-program compilation.

Yes, certainly, but I guess it could be a future direction for Ur/Web.  

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] A direction for Ur/Web

2011-03-27 Thread Karn Kallio
  What about a wiki page ? SASS/HAML could be implemented as well. It
  looks like it doesn't make sense to implement all features of
  haml-lang.com. But most of its syntax is much nicer to write.
  
  I do not think that HAML or SASS add any abstractions that Ur/Web with a
  full CSS support would not already have.  So in that sense implementing
  them would not gain anything.  If Ur/Web gained a sort of a typed macro
  system allowing user level implementation of SASS/HAML as a syntactic
  DSL that would be really interesting.
 
 Why would a macro system be needed?  You can get a long way with
 
 string parsing.  See, for example, this HTML parser:
  http://hg.impredicative.com/meta/file/d05943db55e8/html.urs

Some sort of multistaging mechanism (right, not macros) would be needed to 
allow programmers to prepare type safe source code containing Sass and Haml 
syntax.  Runtime parsers are perfect for supporting things like BBcode in 
forums.  I was conjuring up some imaginary facility for programmers to define 
their own DSL/syntax that would elaborate into well typed Ur/Web or something.  
I realize this would be a research campaign ... take it in the spirit of 
wildly suggesting a possible far far future direction for Ur/Web.

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] A direction for Ur/Web

2011-03-26 Thread Karn Kallio
 What about a wiki page ? SASS/HAML could be implemented as well. It looks
 like it doesn't make sense to implement all features of haml-lang.com.
 But most of its syntax is much nicer to write.

I do not think that HAML or SASS add any abstractions that Ur/Web with a full 
CSS support would not already have.  So in that sense implementing them would 
not gain anything.  If Ur/Web gained a sort of a typed macro system allowing 
user level implementation of SASS/HAML as a syntactic DSL that would be really 
interesting.

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] demo isn't working

2011-02-13 Thread Karn Kallio
 hi all, yesterday i was trying the demo one by one, suddenly the server was
 down and is still unavailable. Is it my network problem or we all
 experience this?
 
 
 --
 Best Regards,
 Liu Qiang

It seems to be the server ... the demos show me this:
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance 
downtime or capacity problems. Please try again later. 

The additional demos ( http://www.impredicative.com/ur/more/ ) and the UrFlow 
demo ( http://www.impredicative.com/ur/scdv/ ) are still available though.


___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


[Ur] Compiler Bug?

2011-01-05 Thread Karn Kallio
Here is an example of Ur/Web code which leads to generation of a webapp.c 
which does not compile ... maybe it is an urweb compiler bug?
Title: Example
example.urp
-
$/list
example

example.urs
-
val main : unit -> transaction page

example.ur
-
val intList = 1 :: 2 :: 3 :: []
val intListList = intList :: intList :: []

fun main () = return 
  
  
Example

  {[intListList]}

  


urweb.stderr
-
/nix/store/bdh974nds32c3rsdvan961ll7bhn9fi9-lkl-urweb/lib/urweb/ur/list.ur:3:23-3:29: Function type remains
/nix/store/bdh974nds32c3rsdvan961ll7bhn9fi9-lkl-urweb/lib/urweb/ur/list.ur:3:23-3:29: Function type remains
/tmp/filePZce0S/webapp.c:38:4: error: expected declaration specifiers or ‘...’ before ‘<’ token
/tmp/filePZce0S/webapp.c:40:50: error: expected declaration specifiers or ‘...’ before ‘<’ token
cc1: warnings being treated as errors
/tmp/filePZce0S/webapp.c: In function ‘__uwn_$showPRIME_unpoly_1275’:
/tmp/filePZce0S/webapp.c:74:15: error: implicit declaration of function ‘__uwr_$x_0’
/tmp/filePZce0S/webapp.c:76:39: error: passing argument 2 of ‘__uwn_$showPRIME_unpoly_1275’ from incompatible pointer type
/tmp/filePZce0S/webapp.c:40:5: note: expected ‘struct __uws_2 *’ but argument is of type ‘int (*)()’
/tmp/filePZce0S/webapp.c:76:39: error: too many arguments to function ‘__uwn_$showPRIME_unpoly_1275’
/tmp/filePZce0S/webapp.c:40:5: note: declared here
/tmp/filePZce0S/webapp.c: In function ‘__uwn_wrap_main_1274’:
/tmp/filePZce0S/webapp.c:240:51: error: passing argument 2 of ‘__uwn_$showPRIME_unpoly_1275’ from incompatible pointer type
/tmp/filePZce0S/webapp.c:40:5: note: expected ‘struct __uws_2 *’ but argument is of type ‘char * (*)(struct uw_context *, struct __uws_1 *)’
/tmp/filePZce0S/webapp.c:240:51: error: too many arguments to function ‘__uwn_$showPRIME_unpoly_1275’
/tmp/filePZce0S/webapp.c:40:5: note: declared here

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] sanity checking

2010-12-13 Thread Karn Kallio
 Karn Kallio wrote:
  Well, looking at the code I thought that it should output both,
  because gcc
  is supposed to support non-constant initializers.  But I am not really
  any help, because I do not know enough about gcc to say.  One thing that
  I do notice in your example is that the printf should be leaving an
  integer in the __uwf_1 position of tmp but how could there be space for
  it (as uw_unit should occupy 0 size) ...
 
 I think this is a confusion between the comma separator between
 initializer elements and the comma operator in expressions.  I think my
 use of parentheses triggers interpretation as the latter, not the former.
 

You are right of course ... I did think it was two initializer elements, but 
now I see that your example initializes the first leaving the second to 
default ... 


___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] Using Ur/Web to create standalone JS applications

2010-12-12 Thread Karn Kallio
 Vag Vagoff wrote:
  On 12.12.2010 18:06, Marc Weber wrote:
  Which kind of application do you have in mind where this really matters?
  Maybe we can help you find an alternative (Eg Amazon cloud like stuff)
  
   You are not specific enough. Which web application do you have in mind?
  
  Various small sites like business cards, web shops and forums.
 
 My suggestion is that, if Ur/Web still sounds promising to you from a
 purely technical standpoint, spend some time making sure it's really the
 right language for you.  Just like its main influences ML and Haskell,
 it probably isn't appropriate for most programmers.
 
 If you still like it and lack of super-cheap hosting services is an
 issue, we may be able to work out some VPS sharing on this list.  I
 wouldn't necessarily be against subsidizing a big chunk of the cost, if
 the language, tools, and community are being advanced.

Has graftid been closed down for good?  The  http://www.graftid.com/  does not 
respond.  I believe Graftid was intended to be something like a community 
arena for Ur/Web development, no?
 

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


[Ur] sanity checking

2010-12-12 Thread Karn Kallio
Same here with gcc (GCC) 4.4.3

[kkal...@eka:~/scratch/test]$ gcc test.c 

[kkal...@eka:~/scratch/test]$ ./a.out 
Outer

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] sanity checking

2010-12-12 Thread Karn Kallio
 Karn Kallio wrote:
  Same here with gcc (GCC) 4.4.3
  
  [kkal...@eka:~/scratch/test]$ gcc test.c
  
  [kkal...@eka:~/scratch/test]$ ./a.out
  Outer
 
 Thanks.  The other important question is whether, when you look at the
 code, you also expect it to output two lines, not just one.

Well, looking at the code I thought that it should output both,  because gcc 
is supposed to support non-constant initializers.  But I am not really any 
help, because I do not know enough about gcc to say.  One thing that I do 
notice in your example is that the printf should be leaving an integer in the 
__uwf_1 position of tmp but how could there be space for it (as uw_unit should 
occupy 0 size) ... 

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] Documentation codes

2010-12-08 Thread Karn Kallio
 Hey folks,
 
 I've taken a look at the Ur/Web demos the other day and
 read a couple emails on the list.
 
 if anyone's worried about Ur/Web surviving or gaining
 wide-spread adoption, well, just fill in as much
 info/examples on the Wiki as you can, and add any usable
 code you might have, or link to your projects.
 
 For example, I'd be very interested in seeing what Marc
 did with the Ruby connector.
 
 Cya,
 Davor

Good idea!  Since I was quite confused about folders a couple of days ago ( 
until Adam pointed out the problem .. thanks! ) I put a sample of usage of 
fold on the Wiki.

http://www.impredicative.com/wiki/index.php/Using_Top.Fold_to_count_fields_of_a_record

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


[Ur] Record subtype constraint

2010-12-07 Thread Karn Kallio
I thought to express record subtyping using Ur/Web's disjointness constraints 
and symmetric concatenation.

This works:

fun subrecord [super :: {Type}] [evidence ::: {Type}] [super ~ evidence] (sub 
: $(super ++ evidence)) = sub

con supertype :: {Type} = [One = string, Two = string]

val subrec = subrecord [supertype] {One = foo, Two = bar, Three = baz}

(* ok, doesn't compile *)
val subrec' = subrecord [supertype] {One = foo, Three = baz}

The Ur/Web compiler automatically finds the evidence showing the value 
argument has a record subtype or gives a compile error if it is not a subtype.

But I thought a better way to witness that a given record is a subtype would 
be to return the portion with the supertype, so we can use the result in 
contexts expecting the supertype.

However, this does not compile:

fun subrecord' [super :: {Type}] [extension ::: {Type}] [super ~ extension] 
(fl : folder super) (sub : $(super ++ extension))
  = fl [fn (r :: {Type}) = ($(super ++ extension) - $r)]
   (fn [nm :: Name] [t :: Type] [r :: {Type}] [[nm] ~ r] acc src = {nm = 
sub.nm} ++ acc (src))
   (fn _ = {}) sub

val subrec' = subrecord' [supertype] {One = foo, Two = bar, Three = baz}

giving error:

f.ur:11:4-11:6: Expression is not a constructor function
Expression:  fl
  Type:  Top.folder[[Type]] super
f.ur:15:26-15:35: Substitution in constructor is blocked by a too-deep 
unification variable
Replacement:  [#One = string, #Two = string]
   Body: 
extension ::: {Type} -
 [UNBOUND_REL1 ~ extension] =
  ((Top.folder[[Type]] UNBOUND_REL1) -
($(UNBOUND_REL1 ++ extension) - UNIF:F::Type))


which looks like the unification does not get into the [fn (r :: {Type}) = 
($(super ++ extension) - $r)] parameter to fl.

What is happening?  Is the compile error due to incompleteness in the 
unification implementation ( related to folder inference maybe? ) or have I 
written nonsense ( and the compiler of course rejects it )?


___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] Record subtype constraint

2010-12-07 Thread Karn Kallio
 Karn Kallio wrote:
  However, this does not compile:
  
  [codesnip]
  
  giving error:
  
  f.ur:11:4-11:6: Expression is not a constructor function
  Expression:  fl
  
 Type:  Top.folder[[Type]] super
 
 This makes sense, since you are trying to apply [fl] as a constructor
 function, but it isn't one, it's a [folder].  [folder] is an abstract
 type family.  You should instead be calling [Top.fold], which can be
 abbreviated to just [fold].

Aha!  Thanks!  In case anyone else wonders how to express record subtype 
constraints I posted a page on the wiki : 
http://www.impredicative.com/wiki/index.php/Expressing_subrecord_constraints



___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] Strategy - UrWeb Backend

2010-12-07 Thread Karn Kallio
 Excerpts from Adam Chlipala's message of Wed Dec 08 00:40:43 +0100 2010:
  Which benefits do you see from server-side JavaScript?  I'll be really
  surprised if any such system can get over the inherent costs of the
  JavaScript language, to match the performance and security of Ur/Web.
 
 Performance does no longer matter much (unless you're Amazon - or
 google) - because servers are so cheap compared to development time -
 and they will be even cheaper tomorrow.

This has been true for the last few decades, but the age of hardware 
improvements may be almost over.  Clock frequency has stopped increasing since 
about 5 years, limited by heat dissipation I believe.  Shrinking die feature 
sizes to even a couple of nanometers gives only about a 100x increase in 
transistor density.  So the industry may be approaching physical limits within 
the next 5 to 10 years that will stall hardware improvements.  Then at the end 
of the hardware era the only way forward will be software.

Disclaimer:  I am not knowledgeable about hardware and of course I can't know 
the future ... only that maybe the inevitable end (physics limits trivially 
mean there has to be an end) of cheaper tomorrow might not be so far ahead

 
 Benefits of JS target:
  - never think about memory
  - interface to existing code more easily (?)
  - existing hosting services (heroku)
 
 You already said that you don't want to target the masses. Having some
 more users helping testing would be fine though :)
 
 Writing tutorials is probably more important right now than having
 NodeJS support. If there are enough skilled users someone will pick it
 up and implement it anyway (?)
 
 Marc Weber

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] Generalizing transactions

2010-12-04 Thread Karn Kallio
 Karn Kallio wrote:
  Adam, now that somebody ( Marc Weber ) is working on an application (
  payment gateway ) where the transaction model of Ur/Web does not cleanly
  apply, is there a chance of you generalizing Ur/Web transactions in a
  safe, principled way ( that allows representing the semantics of the
  application's effectful operations within Ur/Web )?  For example, I
  think that the problem of leaving a permanent record of an event ( e.g.
  receiving an order and not removing it on failure rollback ) could be
  handled with a SAGA that has a null compensation for the process of
  writing the record.
 
 It seems like Marc and I have settled on a very straightforward and
 not-ugly way of implementing what he wants, so this case doesn't seem to
 me like a good impetus to add a new fancy feature.  I'm perfectly happy
 to help you figure out how to implement it yourself, if you want. :-)

Ok :)

Please accept my apologies for sounding snarky or demanding.  I want to be 
clear that I think Ur/Web is an amazing accomplishment and that you are 
breaking important new ground in the design space for the coming generation 
of almost dependently typed languages.

Also, about impredicative kind polymorphism, I was not complaining, only 
trying to make a joke ... I think that for the intended domain the existing 
implementation of kind unification is fine.  To illustrate that Ur/Web *does* 
exhibit impredicativity at the value/type level ( you have already pointed 
this out, but just to undo any confusion I may have left on this list ) I 
posted an example on the wiki at 
http://www.impredicative.com/wiki/index.php/Impredicativity_in_Ur/Web

Once again, thanks for Ur/Web !
 

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] Generalizing transactions

2010-12-01 Thread Karn Kallio
 Excerpts from Karn Kallio's message of Tue Nov 30 16:24:43 +0100 2010:
  Adam, now that somebody ( Marc Weber ) is working on an application (
  payment gateway ) where the transaction model of Ur/Web does not cleanly
  apply, is there a chance of you generalizing Ur/Web transactions in a
  safe, principled way ( that allows representing the semantics of the
  application's effectful operations within Ur/Web )?  For example, I
  think that the problem of leaving a permanent record of an event ( e.g.
  receiving an order and not removing it on failure rollback ) could be
  handled with a SAGA that has a null compensation for the process of
  writing the record.
 
 Karn Kallio: I don't know yet whether I'm going to implement them all -
 or writing some interfaces to reuse existing code.
 
 SAGA? Wikipedia is refering to:
   * SAGA (computing), a Simple API for Grid Applications
   * SAGA GIS, a geographic information system
 
 Do you talk about any of these two?
 
 

I meant these : http://lanl.arxiv.org/abs/1010.5569

 The manual says:
 context is the type of state that persists across handling a client
 request
 
 So it looks like I can use uw_(set,get)_global and uw_malloc to keep
 caches.
 
 I can use the uw_set_global rollback / commit handler to set a flag to
 succeeded or failed in the data structure.
 I know that the free handler will be called after the request finished
 (giving up (fatal error) or suceeding). The flag will tell me whether I
 have to trace a failure in a logfile.
 
 Do you want users to print to stderr for logging - or do you want to
 introduce a logging function which also adds time stamps etc? (good idea
 IMHO) - Does it already exist?
 
 Marc Weber

___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


[Ur] [PATCH] Static link to libmhash when -static parameter given

2010-11-15 Thread Karn Kallio
The Ur/Web compiler links to the libmhash dynamic library independent of the
-static parameter being given to the compiler, which links only the liburweb 
statically.

This patch makes the Ur/Web compiler also link libmhash statically with the -
static flag.  The motivation is to have -static produce programs which can run 
on machines without a special Ur/Web installation ( considering libmhash as 
part of a Ur/Web installation because it is not likely to be found on many 
machines ). 

The goal is to use -static to produce executables which can be placed on 
shared hosting Linux servers with Apache CGI via FTP ... bringing Ur to the 
world 

The patch adds a configure flag --with-mhash-dir to let the Ur/Web compiler 
know how to find libmhash.a in order to pass it along to gcc.

I do not know if this patch will interact badly with the FFI mechanism of 
Ur/Web.

Note: after applying the patch I did $autoreconf -i to update the autotools 
build system.
 
diff -r df7bfb30dcc3 configure.ac
--- a/configure.ac	Sat Nov 13 14:38:06 2010 -0500
+++ b/configure.ac	Mon Nov 15 20:04:17 2010 -0430
@@ -6,8 +6,20 @@
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
 
-AC_CHECK_LIB(mhash, mhash_get_block_size, [], [echo You must install libmhash.; exit 1])
-AC_CHECK_HEADER([mhash.h], [], [echo You must install libmhash dev files.; exit 1])
+dnl Setting the search directory for mhash.
+AC_ARG_WITH(mhash-dir, AS_HELP_STRING([--with-mhash-dir=DIR], [mhash directory; default = /usr]), 
+  with_mhash_dir=$withval, with_mhash_dir=/usr)
+
+dnl Check for libmhash
+LIBS_save=$LIBS
+LIBS=-L${with_mhash_dir}/lib/ -lmhash
+AC_CHECK_LIB(mhash, mhash_get_block_size, 
+[MHASH_LIB_DIR=${with_mhash_dir}/lib], [echo You must install libmhash.; exit 1])
+LIBS=${LIBS_save}
+
+dnl Check for mhash.h
+AC_CHECK_HEADER([${with_mhash_dir}/include/mhash.h],
+[CPPFLAGS=${CPPFLAGS} -I${with_mhash_dir}/include], [echo You must install libmhash dev files.; exit 1])
 
 AC_CHECK_PROG(MLTON, mlton, yes, [])
 
@@ -55,6 +67,7 @@
 AC_SUBST(INCLUDE)
 AC_SUBST(SITELISP)
 AC_SUBST(GCCARGS)
+AC_SUBST(MHASH_LIB_DIR)
 
 AC_CONFIG_FILES([
 Makefile
@@ -67,9 +80,10 @@
 cat EOF
 
 Ur/Web configuration:
-  bin directory:   BIN   $BIN
-  lib directory:   LIB   $LIB
-  include directory:   INCLUDE   $INCLUDE
-  site-lisp directory: SITELISP  $SITELISP
-  Extra GCC args:  GCCARGS   $GCCARGS
+  bin directory:   BIN$BIN
+  lib directory:   LIB$LIB
+  include directory:   INCLUDE$INCLUDE
+  site-lisp directory: SITELISP   $SITELISP
+  mhash lib directory: MHASH_LIB_DIR  $MHASH_LIB_DIR
+  Extra GCC args:  GCCARGS$GCCARGS  
 EOF
diff -r df7bfb30dcc3 src/compiler.sml
--- a/src/compiler.sml	Sat Nov 13 14:38:06 2010 -0500
+++ b/src/compiler.sml	Mon Nov 15 20:04:17 2010 -0430
@@ -1225,16 +1225,16 @@
 let
 val proto = Settings.currentProtocol ()
 
-val lib = if Settings.getStaticLinking () then
-  #linkStatic proto ^   ^ Config.lib ^ /../liburweb.a
-  else
-  -L ^ Config.lib ^ /.. -lurweb  ^ #linkDynamic proto
-
+val (lib, mhash) = if Settings.getStaticLinking () then
+   (#linkStatic proto ^   ^ Config.lib ^ /../liburweb.a, Config.libMhash ^ /libmhash.a)
+   else
+   (-L ^ Config.lib ^ /.. -lurweb  ^ #linkDynamic proto, -L ^ Config.libMhash ^  -lmhash)
+ 
 val compile = gcc  ^ Config.gccArgs ^  -Wimplicit -Werror -O3 -fno-inline -I  ^ Config.includ
   ^   ^ #compile proto
   ^  -c  ^ cname ^  -o  ^ oname
 
-val link = gcc -Werror -O3 -lm -lmhash -pthread  ^ Config.gccArgs ^   ^ libs ^   ^ lib ^   ^ oname
+val link = gcc -Werror -O3 -lm -pthread  ^ Config.gccArgs ^   ^ libs ^   ^ lib ^   ^ mhash  ^   ^ oname
^  -o  ^ ename
 
 val (compile, link) =
diff -r df7bfb30dcc3 src/config.sig
--- a/src/config.sig	Sat Nov 13 14:38:06 2010 -0500
+++ b/src/config.sig	Mon Nov 15 20:04:17 2010 -0430
@@ -9,4 +9,5 @@
 val libJs : string
 
 val gccArgs : string
+val libMhash : string
 end
diff -r df7bfb30dcc3 src/config.sml.in
--- a/src/config.sml.in	Sat Nov 13 14:38:06 2010 -0500
+++ b/src/config.sml.in	Mon Nov 15 20:04:17 2010 -0430
@@ -14,4 +14,6 @@
 
 val gccArgs = @GCCARGS@
 
+val libMhash = @MHASH_LIB_DIR@
+
 end
___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] new user having some questions such as a:::Type twice? and more

2010-09-29 Thread Karn Kallio
With regards to 8) there is a mercurial repository available; 

hg clone http://hg.impredicative.com/urweb

should get you a copy.




___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


Re: [Ur] Exceptions handling

2010-09-06 Thread Karn Kallio
 Vladimir Shabanov wrote:
  So savepoint will be introduced only where it really needed (dml with
  user error handling)? I think that this is the best solution.
 
 Yes, that's what I meant.
 
  BTW it can be useful to have function for cancelling (and maybe
  restarting) transaction as a part of error handling.
 
 In Ur/Web, transactions are used for all state, not just the database.
 I would want to have a reasonable integration of transaction restart
 with all kinds of state, which can include arbitrary protocols thanks to
 C FFI libraries.  That would complicate the FFI, so I'll leave this out
 for now.  If a compelling use case comes up, let me know.

In PostgreSQL, use of the Serializable transaction isolation level will give 
failures whenever for example a transaction selects a set of rows and another 
concurrent transaction modifies some before the query finishes.

These serialization failure errors generally need the application to cancel 
and retry the transaction.

So I suppose with PostgreSQL, a use case could be any situation where 
Serializable isolation levels are called for.

Transactions that include a mixture of complicated selects and updates will 
probably need the Serializable isolation level.  An example could be some sort 
of reporting application where presentation tables are filled with results 
computed from input tables via multiple steps with several layers of tables 
holding intermediate results.  If many users are concurrently adding data to 
the input tables and viewing the presentation tables Serializable would 
probably be necessary.  Whenever two users input data that resulted in 
overlapping changes in an intermediate result table cancel/retry would have to 
be done.

Reference: http://www.postgresql.org/docs/8.4/static/transaction-iso.html 
Section 13.2.2



___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur


[Ur] Ur/Web in Nixos

2010-08-23 Thread Karn Kallio
Maybe of interest:

While packaging Ur/Web for NixOS ( http://nixos.org/ , a Linux distribution 
using a non-standard prefix-based directory layout ) it was necessary to apply 
a patch removing the postgresql directory prefix hardcoded in the header paths 
in the file postgres.sml.

I believe using GCCARGS to pass include directory locations via -I can't be 
made to work without introducing symlinks or some such whenever the actual 
header files mysql.h and libpq-fe.h are contained in directories not named 
postgresql and mysql.

Removing the prefixes allows GCCARGS to determine the location; I imagine it 
will also make the build fail on standard filesystem layouts without some more 
autotools tweaking.

Anyway, here is the patch removing the prefix directories.


diff -Naur urweb-orig/src/mysql.sml urweb-patched/src/mysql.sml
--- urweb-orig/src/mysql.sml	2010-08-23 15:36:58.665234434 -0430
+++ urweb-patched/src/mysql.sml	2010-08-23 15:44:10.765238334 -0430
@@ -1521,7 +1521,7 @@
 fun p_blank _ = ?
 
 val () = addDbms {name = mysql,
-  header = mysql/mysql.h,
+  header = mysql.h,
   link = -lmysqlclient,
   init = init,
   p_sql_type = p_sql_type,
diff -Naur urweb-orig/src/postgres.sml urweb-patched/src/postgres.sml
--- urweb-orig/src/postgres.sml	2010-08-23 15:36:58.666253464 -0430
+++ urweb-patched/src/postgres.sml	2010-08-23 15:43:26.216251221 -0430
@@ -928,7 +928,7 @@
 fun p_blank (n, t) = p_cast ($ ^ Int.toString n, t)
 
 val () = addDbms {name = postgres,
-  header = postgresql/libpq-fe.h,
+  header = libpq-fe.h,
   link = -lpq,
   p_sql_type = p_sql_type,
   init = init,
___
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur