Re: default roles

2013-10-08 Thread José Pedro Magalhães
Hi,

On Tue, Oct 8, 2013 at 3:21 AM, Richard Eisenberg e...@cis.upenn.edu wrote:

 We considered this for a while, but it led to a strange design -- to do it
 right, you would have to import all constructors for all datatypes
 *recursively* out to the leaves, starting at the datatypes mentioned in the
 class for which you wanted to use GND. This would mean potentially a whole
 lot of imports for symbols not actually used in the text of a program.


I'm not sure I understand why constructors are involved in this. Wouldn't
something like
the following potentially be useful?

data Role = Nominal | Representational | Phantom | Fun Role Role

type family HasRole (t :: k) :: Role

data MyData a b = MyData a
data MyGADT a b where MyGADT :: MyGADT a Int

type instance HasRole MyData  = Fun Representational Phantom
type instance HasRole MyGADT  = Fun Representational Nominal
type instance HasRole Traversable = Nominal

HasRole instances would be automatically given by GHC.


Cheers,
Pedro
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: ghc src snapshots

2013-10-08 Thread Jens Petersen
I built 
http://petersen.fedorapeople.org/ghc/ghc-7.7.20131005-src.tar.bz2http://petersen.fedorapeople.org/ghc/
for Fedora (http://koji.fedoraproject.org/koji/taskinfo?taskID=6034005)
and uploaded the builds for x86_64, i686 and armv7hl to my fedorapeople
repo:

  http://repos.fedorapeople.org/repos/petersen/ghc-7.7

Initial basic testing suggests it works okay, but let me
know if you notice any Fedora specific problems.

Jens
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: default roles

2013-10-08 Thread Richard Eisenberg
Pedro is suggesting a way for a Haskell type-level program to gain access to 
role information. This might indeed be useful, but it doesn't seem terribly 
related to the problem of defaults / abstraction. The problem has to do with 
definitions like these:

 module A where
 data S a b = S1 a | S2 b
 data T a b = MkT (S a b)

 module B where
 import A ( {- what goes here? -} )

 class C a where
   mkT :: T Bool a

 instance C Int where ...
 newtype Age = MkAge Int deriving C

What constructors do we need in order to convert the (C Int) instance to (C 
Age) by hand? To me, it looks like we need MkT and S2, but not S1. Yet, this is 
not obvious and seems to be quite confusing.

I hope this helps understanding the issue!
Richard

On Oct 8, 2013, at 4:01 AM, José Pedro Magalhães drei...@gmail.com wrote:

 Hi,
 
 On Tue, Oct 8, 2013 at 3:21 AM, Richard Eisenberg e...@cis.upenn.edu wrote:
 We considered this for a while, but it led to a strange design -- to do it 
 right, you would have to import all constructors for all datatypes 
 *recursively* out to the leaves, starting at the datatypes mentioned in the 
 class for which you wanted to use GND. This would mean potentially a whole 
 lot of imports for symbols not actually used in the text of a program.
 
 I'm not sure I understand why constructors are involved in this. Wouldn't 
 something like
 the following potentially be useful?
 
 data Role = Nominal | Representational | Phantom | Fun Role Role
 
 type family HasRole (t :: k) :: Role
 
 data MyData a b = MyData a
 data MyGADT a b where MyGADT :: MyGADT a Int
 
 type instance HasRole MyData  = Fun Representational Phantom
 type instance HasRole MyGADT  = Fun Representational Nominal
 type instance HasRole Traversable = Nominal
 
 HasRole instances would be automatically given by GHC.
 
 
 Cheers,
 Pedro
 
 

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: default roles

2013-10-08 Thread Miguel
I don't understand it either.

Type family solution, however, seems wrong. See, if we, somehow, make
something nominal when it has to be representational — well, some code
won't compile, but nothing really bad happens. If, on the other hand, we by
some miracle make something representational when in should be nominal — we
can get a runtime error. It seems to be very similar to how type classes
work, with nominal being the default, and representational a type class.

Consider, for example, the Tricky example from the slides, slightly
changed:

data Tricky2 a b c = MkTricky2 (a c) (b c)

Currently parameter c would be nominal. I suggest that it should be
representational if and only if it's representational for BOTH a and b.
WIth type classes it would be very simple:

instance (HasRepresentationalParameter a, HasRepresentationalParameter b)
= HasRepresentationalParameter (Tricky2 a b)

With type families... well, apparently I don't have enough milliolegs to
figure out how to do it.


On Tue, Oct 8, 2013 at 12:01 PM, José Pedro Magalhães drei...@gmail.comwrote:

 Hi,

 On Tue, Oct 8, 2013 at 3:21 AM, Richard Eisenberg e...@cis.upenn.eduwrote:

 We considered this for a while, but it led to a strange design -- to do
 it right, you would have to import all constructors for all datatypes
 *recursively* out to the leaves, starting at the datatypes mentioned in the
 class for which you wanted to use GND. This would mean potentially a whole
 lot of imports for symbols not actually used in the text of a program.


 I'm not sure I understand why constructors are involved in this. Wouldn't
 something like
 the following potentially be useful?

 data Role = Nominal | Representational | Phantom | Fun Role Role

 type family HasRole (t :: k) :: Role

 data MyData a b = MyData a
 data MyGADT a b where MyGADT :: MyGADT a Int

 type instance HasRole MyData  = Fun Representational Phantom
 type instance HasRole MyGADT  = Fun Representational Nominal
 type instance HasRole Traversable = Nominal

 HasRole instances would be automatically given by GHC.


 Cheers,
 Pedro



 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: default roles

2013-10-08 Thread Richard Eisenberg
Perhaps I can spot the source of the confusion: there seem to be 2 different 
conversations going on here!

1: How to fit roles in with the ability to declare a datatype to be abstract. 
Should a library author be required to use a role annotation to make an 
abstract datatype, or should a library author be required to use a role 
annotation to allow GND with a datatype?

2: Some form of role abstraction, where an argument to a type parameter might 
get a representational role, depending on the role of some other variable. 
Using typeclasses is the current proposal for how to do this, and it in 
migmit's email below. Pedro also suggests a type families approach.


My initial email was seeking advice on issue #1.

As for #2: Using typeclasses here might be a decent surface syntax for the 
feature of role abstraction, but the automatic generation of instances, etc., 
would seem to require deep and pervasive magic under the hood. Essentially, 
every type and type variable would need to be annotated with both a kind and a 
role, significantly complicating GHC's type system. The question would be 
whether or not this upfront and ongoing investment is worth it.

Thanks,
Richard

On Oct 8, 2013, at 10:49 AM, Miguel mig...@gmail.com wrote:

 I don't understand it either.
 
 Type family solution, however, seems wrong. See, if we, somehow, make 
 something nominal when it has to be representational — well, some code won't 
 compile, but nothing really bad happens. If, on the other hand, we by some 
 miracle make something representational when in should be nominal — we can 
 get a runtime error. It seems to be very similar to how type classes work, 
 with nominal being the default, and representational a type class.
 
 Consider, for example, the Tricky example from the slides, slightly changed:
 
 data Tricky2 a b c = MkTricky2 (a c) (b c)
 
 Currently parameter c would be nominal. I suggest that it should be 
 representational if and only if it's representational for BOTH a and b. WIth 
 type classes it would be very simple:
 
 instance (HasRepresentationalParameter a, HasRepresentationalParameter b) = 
 HasRepresentationalParameter (Tricky2 a b)
 
 With type families... well, apparently I don't have enough milliolegs to 
 figure out how to do it.
 
 
 On Tue, Oct 8, 2013 at 12:01 PM, José Pedro Magalhães drei...@gmail.com 
 wrote:
 Hi,
 
 On Tue, Oct 8, 2013 at 3:21 AM, Richard Eisenberg e...@cis.upenn.edu wrote:
 We considered this for a while, but it led to a strange design -- to do it 
 right, you would have to import all constructors for all datatypes 
 *recursively* out to the leaves, starting at the datatypes mentioned in the 
 class for which you wanted to use GND. This would mean potentially a whole 
 lot of imports for symbols not actually used in the text of a program.
 
 I'm not sure I understand why constructors are involved in this. Wouldn't 
 something like
 the following potentially be useful?
 
 data Role = Nominal | Representational | Phantom | Fun Role Role
 
 type family HasRole (t :: k) :: Role
 
 data MyData a b = MyData a
 data MyGADT a b where MyGADT :: MyGADT a Int
 
 type instance HasRole MyData  = Fun Representational Phantom
 type instance HasRole MyGADT  = Fun Representational Nominal
 type instance HasRole Traversable = Nominal
 
 HasRole instances would be automatically given by GHC.
 
 
 Cheers,
 Pedro
 
 
 
 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
 
 

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


RTS option -A affecting cpu-core usage?

2013-10-08 Thread Daniel Trstenjak

Hi all,

I played around with a parallel algorithm and tried to get the GC time
down by specifying the RTS option '-A'.

But if I'm specifying '-A' than also the usage of the cpu-cores seems to
change. Without '-A' I'm getting a total cpu-core usage of '4.44s',
with '-A' I'm getting only '1.67s'.

Any ideas?


Greetings,
Daniel


Without '-A':
-

dan@machine ~ ghc-mod-dev find showWindows +RTS -s -N4
XMonad.Util.XUtils
 980,770,296 bytes allocated in the heap
 552,122,168 bytes copied during GC
 163,683,152 bytes maximum residency (11 sample(s))
   4,369,800 bytes maximum slop
 280 MB total memory in use (0 MB lost due to fragmentation)

Tot time (elapsed)  Avg pause  Max pause
  Gen  0  1690 colls,  1690 par2.45s0.66s 0.0004s0.0024s
  Gen  111 colls,10 par0.98s0.26s 0.0239s0.1022s

  Parallel GC work balance: 18.06% (serial 0%, perfect 100%)

  TASKS: 6 (1 bound, 5 peak workers (5 total), using -N4)

  SPARKS: 1025 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 1025 fizzled)

  INITtime0.00s  (  0.00s elapsed)
  MUT time0.99s  (  0.83s elapsed)
  GC  time3.43s  (  0.93s elapsed)
  EXITtime0.02s  (  0.02s elapsed)
  Total   time4.44s  (  1.78s elapsed)

  Alloc rate995,571,064 bytes per MUT second

  Productivity  22.7% of total user, 56.5% of total elapsed

gc_alloc_block_sync: 53552
whitehole_spin: 0
gen[0].sync: 75
gen[1].sync: 23678


With '-A':
--

dan@machine ~ ghc-mod-dev find showWindows +RTS -s -N4 -A500m
XMonad.Util.XUtils
 979,761,872 bytes allocated in the heap
  94,043,424 bytes copied during GC
 118,609,784 bytes maximum residency (2 sample(s))
   2,844,808 bytes maximum slop
2196 MB total memory in use (0 MB lost due to fragmentati

Tot time (elapsed)  Avg pause  Ma
  Gen  0 0 colls, 0 par0.00s0.00s 0.s
  Gen  1 2 colls, 1 par0.47s0.18s 0.0878s

  Parallel GC work balance: 57.02% (serial 0%, perfect 100%)

  TASKS: 6 (1 bound, 5 peak workers (5 total), using -N4)

  SPARKS: 1025 (616 converted, 0 overflowed, 0 dud, 0 GC'd, 409 fizzl

  INITtime0.02s  (  0.02s elapsed)
  MUT time1.16s  (  1.16s elapsed)
  GC  time0.47s  (  0.18s elapsed)
  EXITtime0.02s  (  0.02s elapsed)
  Total   time1.67s  (  1.38s elapsed)

  Alloc rate844,914,346 bytes per MUT second

  Productivity  70.8% of total user, 85.9% of total elapsed

gc_alloc_block_sync: 33458
whitehole_spin: 0
gen[0].sync: 5372
gen[1].sync: 0
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: RTS option -A affecting cpu-core usage?

2013-10-08 Thread Daniel Trstenjak

Ok, I think I got it. The cpu-cores are spending most of their time
doing GC, by reducing the GC time the cpu-cores don't have anything
left to do.

Seems like a really great parallel algorithm ;).


Greetings,
Daniel
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell] Deadline extension for PEPM 2014 (co-located with POPL in San Diego)

2013-10-08 Thread Jurriaan Hage
LS.

Please consider submitting your work on program transformation,
partial evaluation, meta programming and program analysis, to 
PEPM 2014. Papers can be 12 pages in length ACM style 
(the size of a typical ICFP and POPL submission). 

Apologies for multiple postings.

best,
Jurriaan Hage and Wei-Ngan Chin

PEPM 2014 - FINAL DEADLINE EXTENSION


Due to a number of requests for extensions, the deadline for full
paper submission to PEPM 2014 has been extended until 23:59 GMT
on Tuesday 15 October. We would like to highlight two aspects
of our CFP.

Journal Special Issue
-
We are planning for a journal special issue of recommended papers
from PEPM'14. For this year, we expect the special issue to be
with the Science of Computer Programming.

Short papers and Tool papers

We are looking for short papers (up to 6pp) and tool papers as well as
full research papers. All categories of papers will appear in the formal
ACM proceedings. In the case of tool papers, a live demonstration of
the described tool is expected during the presentation at PEPM.

More details on the PEPM 2014 can be found on web site below.

  http://www.program-transformation.org/PEPM14


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


Re: [Haskell-cafe] ANN: E-book version of the Typeclassopedia

2013-10-08 Thread Alfredo Di Napoli
Thanks, I wanted this for a long time as well!

A.


On 5 October 2013 17:25, Flavio Villanustre fvillanus...@gmail.com wrote:

 Very useful, thanks!
 On Oct 4, 2013 9:13 AM, Erlend Hamberg ehamb...@gmail.com wrote:

 While re-reading Brent Yorgey's Excellent Typeclassopedia I converted it
 to Pandoc Markdown in order to be able to create an EPUB version. Having
 a “real” e-book meant that I could comfortably read it on my e-book
 reader and highlight text and take notes while reading. I also fixed
 some minor issues while reading it. (These fixes were of course
 backported to the official Typeclassopedia version on the Haskell Wiki.)

 The EPUB file can be downloaded from Github:

 https://github.com/ehamberg/typeclassopedia-md/releases

 The Markdown source is also available in that repo and you can of course
 use Pandoc to convert the Markdown file to all the other output formats
 Pandoc supports.

 By using a program like Calibre, the EPUB file can be converted to other
 e-book formats such as the Kindle format.

 I hope people find this useful. :-)

 --
 Erlend Hamberg
 ehamb...@gmail.com

 ___
 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] Interfacing real-time stocks data API

2013-10-08 Thread Miro Karpis
Please, did/does anybody tried to interface with Haskell some real-time
stocks data API? If yes, please which one? So far I came down to
ActveTick,...

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


[Haskell-cafe] ANN: hsqml-0.2.0.0

2013-10-08 Thread Robin KAY

Dear All,

I would like to announce version 0.2.0.0 of the HsQML graphics library.

HsQML provides a Haskell binding to the Qt Quick framework. It allows 
you to write graphical applications where the front-end is written in Qt 
Quick's QML language (incorporating JavaScript) and the back-end is 
written in Haskell. The two layers are coupled together via a facility 
to define custom JavaScript objects through which QML code can call into 
Haskell and vice versa.


HsQML requires an installation of Qt 4.7 or 4.8 (including 
QtDeclarative) present on your path.


This release introduces several new features, including support for 
firing QML signals from Haskell code and MacOS support. A number of bugs 
have also been resolved. For more information, please see my web site 
[1] and the Hackage page [2].


The hsqml-morris demo application [3], which implements the game of Nine 
Men's Morris against an AI opponent, has also been updated to 0.2.0.0. 
It now uses QML signals to run the game's AI processing outside of the 
event loop so as to maintain a responsive UI.


My goals for the next release are to work on writing a proper user 
manual and to migrate the library over to work with Qt 5.x.


[1] http://www.gekkou.co.uk/software/hsqml
[2] http://hackage.haskell.org/package/hsqml-0.2.0.0
[3] http://hackage.haskell.org/package/hsqml-morris-0.2.0.0

Regards,

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


Re: [Haskell-cafe] Using Quick Check generators for getting arbitrary value streams

2013-10-08 Thread adam vogt
Hi Luke,

It seems like you missed this module:
http://hackage.haskell.org/package/QuickCheck-2.6/docs/Test-QuickCheck-Gen.html

Adam

On Mon, Oct 7, 2013 at 7:21 PM, Luke Evans l...@eversosoft.com wrote:
 I was hoping I could use Arbitrary instances to generate streams of values 
 for test data.
 It looks like you're not 'supposed' to be trying this, other than for the 
 specific purpose of then testing some properties on these streams within 
 Quick Check itself.

 I'm looking for something like the sample' function in Quick Check, only to 
 produce an infinite stream of values (rather than the 11 values that are 
 clearly designed simply to give you a sense of the output of a generator).
 Am I out of luck, or is there yet some cunning way of doing this without 
 hacking the Quick Check package to export the MkGen constructor?

 -- Luke

 ___
 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: [arch-haskell] Snap web framework - not in ArchHaskell?

2013-10-08 Thread Nicola Squartini
If you don't mind using happstack instead as a web framework, there is my
repository [haskell-happstack]. It also contains many packages that are in
common with snap and yesod.


On Tue, Oct 8, 2013 at 11:54 AM, Dawid Loubser dawid.loub...@ibi.co.zawrote:

 Hi all,

 I noticed that neither the snap, nor the yesod web frameworks are in the
 arch-haskell repo - is there a specific reason for this?

 What would you recommend is the best way to install and use snap?
 (since it has been made clear that cabal is not a package manager, yet
 snap recommends installing it via cabal... :-S )

 kind regards,

 --
 Dawid Loubser dawid.loub...@ibi.co.za


 ___
 arch-haskell mailing list
 arch-haskell@haskell.org
 http://www.haskell.org/mailman/listinfo/arch-haskell


___
arch-haskell mailing list
arch-haskell@haskell.org
http://www.haskell.org/mailman/listinfo/arch-haskell


Re: [arch-haskell] Snap web framework - not in ArchHaskell?

2013-10-08 Thread Bardur Arantsson
On 2013-10-08 11:54, Dawid Loubser wrote:
 Hi all,
 
 I noticed that neither the snap, nor the yesod web frameworks are in the
 arch-haskell repo - is there a specific reason for this?
 
 What would you recommend is the best way to install and use snap?
 (since it has been made clear that cabal is not a package manager, yet
 snap recommends installing it via cabal... :-S )
 

Well, it's not *really* a package manager, but it seems to be growing in
that direction... :)

Anyway, any users of Snap are probably going to be developers, and I
think it's pretty par for the course for developers to install libraries
they're using from Hackage.

I would recommend using hsenv for keeping per-project Cabal
environments. (The new Cabal will have support for similar isolation,
but I don't think it's really been released yet.)

Regards,

Bárður

___
arch-haskell mailing list
arch-haskell@haskell.org
http://www.haskell.org/mailman/listinfo/arch-haskell