Re: [Haskell-cafe] Store type-class polymorphic values generically

2013-10-04 Thread Simon Peyton-Jones
| However, I want to write this as a core-to-core | translation as a ghc-plugin. I want the definition go = putStrLn "Hello | World!" to be translated to what I wrote above. Core cannot generate new | names to be exported from a module, so go_ is now gone. Wait... what do you mean "Core cannot gen

[Haskell-cafe] Using lenses

2013-10-03 Thread Simon Peyton-Jones
(I sent this to 'libraries' but Kim-Ee suggested adding Café, where so many smart people hang out.) Friends Some of you will know that I've promised to give a talk about Edward's lens library at the Haskell Exchange

Re: [Haskell-cafe] An APL library for Haskell

2013-09-16 Thread Simon Peyton-Jones
PS: Oddly I sent this message in March 2012. I don't know why it has taken over year for it to be delivered! Simon From: Haskell-Cafe [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Simon Peyton-Jones Sent: 08 March 2012 13:45 To: hask...@haskell.org; Haskell Cafe Cc: Lennart Augus

[Haskell-cafe] An APL library for Haskell

2013-09-15 Thread Simon Peyton-Jones
Friends Many of you will know the array language APL. It focuses on arrays and in particular has a rich, carefully-thought-out array algebra. An obvious idea is: what would a Haskell library that embodies APL's array algebra look l

Re: [Haskell-cafe] Extending Type Classes

2013-08-26 Thread Simon Peyton-Jones
See http://ghc.haskell.org/trac/ghc/wiki/DefaultSuperclassInstances | -Original Message- | From: Haskell-Cafe [mailto:haskell-cafe-boun...@haskell.org] On Behalf | Of Henning Thielemann | Sent: 26 August 2013 20:07 | To: Frantisek Farka | Cc: Haskell Cafe | Subject: Re: [Haskell-cafe] Exte

Re: [Haskell-cafe] What am I missing? Cycle in type synonym declarations

2013-08-21 Thread Simon Peyton-Jones
GHC tries to typecheck quotations. In this case it's trying to typecheck the declaration type Bar = FooT $t Part of type checking is rejecting recursive type synonyms. Here GHC is rejecting it because it *might* be recursive, depending on how $t is filled in. The trouble is that we rea

Re: [Haskell-cafe] Alternative name for return

2013-08-14 Thread Simon Peyton-Jones
| Indeed, I wished the 0-ary case would be more alike to the unary and | binary case, cf. | | return f0 | f1 <$> a1 | f2 <$> a1 <*> a2 | | What is needed is a nice syntax for "idiom brackets". Indeed. I'm quite open to adding idiom brackets to GHC, if everyone can agree on the

Re: [Haskell-cafe] type-level integers for GHC

2013-05-20 Thread Simon Peyton-Jones
Road, Cambridge, CB1 2FB | -Original Message- | From: Christiaan Baaij [mailto:christiaan.ba...@gmail.com] | Sent: 20 May 2013 09:56 | To: Takayuki Muranushi | Cc: Simon Peyton-Jones; haskell | Subject: Re: [Haskell-cafe] type-level integers for GHC | | What works best for me is to

Re: [Haskell-cafe] type-level integers for GHC

2013-05-17 Thread Simon Peyton-Jones
I wonder why you can't compile type-nats? It should just work. You could email ghc-devs and Iavor (type-nats author, cc'd) explaining exactly what goes wrong. You may need the type-nats branch of some libraries, I'm not sure Simon Microsoft Research Limited (company number 03369488) is regist

Re: [Haskell-cafe] Backward compatibility

2013-05-03 Thread Simon Peyton-Jones
One of the great things about the Haskell mailing lists is the supportive, respectful tone that is the dominant mode of discourse. I sense that things are getting a little out of control in this particular thread. Even though this particular issue is clearly extremely frustrating for those inv

Re: [Haskell-cafe] Where's the case? or The difference between simpl and prep

2013-03-14 Thread Simon Peyton-Jones
Check out http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/HscMain and the notes at the top of http://darcs.haskell.org/ghc/compiler/coreSyn/CorePrep.lhs Beyond that I'm happy to help Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:hask

Re: [Haskell-cafe] RFC: rewrite-with-location proposal

2013-02-26 Thread Simon Peyton-Jones
on was trying to re-use an existing feature, with a small twist, to do what you want, rather than to implement something brand new. Simon From: michael.snoy...@gmail.com [mailto:michael.snoy...@gmail.com] On Behalf Of Michael Snoyman Sent: 25 February 2013 18:19 To: Simon Peyton-Jones Cc: Alexan

Re: [Haskell-cafe] RFC: rewrite-with-location proposal

2013-02-25 Thread Simon Peyton-Jones
I’m afraid the rewrite-rule idea won’t work. RULES are applied during optimisation, when tons of inlining has happened and the program has been shaken around a lot. No reliable source location information is available there. See http://hackage.haskell.org/trac/ghc/wiki/ExplicitCallStack; and pl

Re: [Haskell-cafe] Advice on type families and non-injectivity?

2013-01-14 Thread Simon Peyton-Jones
Oh! Is the definition of 'foo' rejected in recent versions of GHC? My 7.4.1 installation doesn't complain. -- Conal Yes, it is rejected. Simon From: conal.elli...@gmail.com [mailto:conal.elli...@gmail.com] On Behalf Of Conal Elliott Sent: 14 January 2013 20:52 To: Simon

Re: [Haskell-cafe] Advice on type families and non-injectivity?

2013-01-14 Thread Simon Peyton-Jones
| > > {-# LANGUAGE TypeFamilies #-} | > > | > > type family F a | > > | > > foo :: F a | > > foo = undefined | > > | > > bar :: F a | > > bar = foo There is a real difficulty here with type-checking 'bar'. (And that difficulty is why 'foo' is also rejected.) Namely, when typechecking 'bar', we

[Haskell-cafe] The end of an era, and the dawn of a new one

2012-12-05 Thread Simon Peyton-Jones
hope will | ultimately be a good thing for Haskell too. | | What does this mean for GHC? Obviously I'll have much less time to work | on GHC, but I do hope to find time to fix a few bugs and keep things | working smoothly. Simon Peyton Jones will still be leading the project, | and we'll

Re: [Haskell-cafe] Erroneous interaction between DataKinds and ExistentialQuantification?

2012-10-19 Thread Simon Peyton-Jones
Quite right -- a bug. Thank you. I'll add it to the regression suite Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe- | boun...@haskell.org] On Behalf Of Stefan Holdermans | Sent: 17 October 2012 21:45 | To: Haskell Cafe | Cc: José Pedro Mag

Re: [Haskell-cafe] Call for discussion: OverloadedLists extension

2012-09-25 Thread Simon Peyton-Jones
| pointer to the actual data somewhere in memory and use that. This is | more or less what happens for strings at the moment, even though you | have to use rewrite rules to get at the pointer which, in my opinion, is | neither ideal nor really necessary. IMO, the "right" design shouldn't | rely on

Re: [Haskell-cafe] Call for discussion: OverloadedLists extension

2012-09-25 Thread Simon Peyton-Jones
| Here at the University of Tübingen, I am co-supervising (together with | Jeroen Weijers) a student project implementing the OverloadedLists | extension for GHC. Achim Krause is the student who is working on the | project. We took into consideration earlier discussions on this topic | [1,2] before

Re: [Haskell-cafe] Call for discussion: OverloadedLists extension

2012-09-24 Thread Simon Peyton-Jones
| I remember a similar discussion a few years ago. The question of whether | or not overloading list literals a good idea notwithstanding, the problem | with this is that fromList for vectors is highly inefficient. So if | something like this gets implemented and if vector/array literals are on

Re: [Haskell-cafe] Call for discussion: OverloadedLists extension

2012-09-24 Thread Simon Peyton-Jones
| Many of us use the OverloadedStrings language extension on a regular | basis. It provides the ability to keep the ease-of-use of string | literal syntax, while getting the performance and correctness | advantages of specialized datatypes like ByteString and Text. I think | we can get the sam

Re: [Haskell-cafe] why do I need class context in declaring data constructor?

2012-08-31 Thread Simon Peyton-Jones
Aha. See http://hackage.haskell.org/trac/ghc/ticket/7205. I don't think there's a workaround, I'm afraid Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe- | boun...@haskell.org] On Behalf Of Paul Liu | Sent: 30 August 2012 20:52 | To: Haskell Cafe

Re: [Haskell-cafe] Rigid skolem type variable escaping scope

2012-08-22 Thread Simon Peyton-Jones
| This compiles just fine, as I would expect. But now let's say I want | to change it to make IntFn a newtype: | | newtype IntFn a = IntFn (a -> Int) | | bar :: (forall a. (FooClass a) => IntFn a) -> Bool | bar (IntFn fn) = foo fn The easiest way is to imagine transforming the funct

Re: [Haskell-cafe] Noticed this change about infix decls in GHC 7.4.2

2012-06-18 Thread Simon Peyton-Jones
Yes, it's a bug. Happily a dup of http://hackage.haskell.org/trac/ghc/ticket/6120, which is already fixed. I'll add your program as a regression test though. Thanks for reporting Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe- | boun...@has

Re: [Haskell-cafe] converting functional dependencies to type families

2012-06-11 Thread Simon Peyton-Jones
Thanks. I've linked to it from http://www.haskell.org/haskellwiki/GHC/Type_families#Frequently_asked_questions | -Original Message- | From: Henning Thielemann [mailto:lemm...@henning-thielemann.de] | Sent: 10 June 2012 15:14 | To: Simon Peyton-Jones | Cc: Haskell Cafe | Subjec

Re: [Haskell-cafe] GHC 7.4 and TypeSynonymInstances

2012-06-06 Thread Simon Peyton-Jones
It's deliberate. As the user manual says (http://www.haskell.org/ghc/docs/latest/html/users_guide/flag-reference.html#id3101511), FlexibleInstances implies TypeSynonymInstances. See Trac http://hackage.haskell.org/trac/ghc/ticket/4841 I'll clarify the docs a bit. Simon | -Original Messag

Re: [Haskell-cafe] Fundeps and overlapping instances

2012-06-04 Thread Simon Peyton-Jones
| > My take is that we should abandon Fundeps, and concentrate on | > introducing overlaps into type functions in a controlled way (what | > I've called 'dis- overlapped overlaps'.) | | Abandoning fundeps would be a sad day for type-level programming. | There are many things other than overlaps th

Re: [Haskell-cafe] Typed TemplateHaskell?

2012-05-24 Thread Simon Peyton-Jones
Maybe take a look at http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe- | boun...@haskell.org] On Behalf Of Tillmann Rendel | Sent: 23 May 2012 18:20 | To: Haskell Café | Subject: Re:

Re: [Haskell-cafe] Data Kinds and superfluous (in my opinion) constraints contexts

2012-05-10 Thread Simon Peyton-Jones
I'm glad you've been trying out kinds. However, I don't understand the feature you want here. You say: fromIntgr :: Integer -> BV (size :: D) fromIntgr int = BV mkD int -- doesn't work, but desired. fromIntgr :: MkD size => Integer -> BV (size :: D) fromIntgr int = BV mkD int -- does wor

Re: [Haskell-cafe] Printing call site for partial functions

2012-04-26 Thread Simon Peyton-Jones
Tristan Allwood got quite a long way with this a couple of years ago. http://research.microsoft.com/en-us/um/people/simonpj/papers/stack-trace/DebugTraces.pdf But not enough to finish it off! The paper describes the tricky points... Simon M is more of an expert than I. Moreover the work Simon ha

Re: [Haskell-cafe] Some thoughts on Type-Directed Name

2012-01-30 Thread Simon Peyton-Jones
| What would really, really help me is for someone to have a look at the 'solution' I | posted to the difficulties SPJ saw with the SORF approach. (I ref'd it in my reply to In response to your plea, I took a look at your post http://www.haskell.org/pipermail/glasgow-haskell-users/2011-Dece

[Haskell-cafe] FW: [Haskell] Job Opportunity at Parallel Scientific

2011-11-21 Thread Simon Peyton-Jones
I'm taking the liberty of forwarding this super-relevant advert to Haskell Cafe in case any readers read the Cafe but not the main Haskell mailing list. Simon From: haskell-boun...@haskell.org [mailto:haskell-boun...@haskell.org] On Behalf Of Peter Braam Sent: 21 November 2011 22:23 To: haskell

Re: [Haskell-cafe] When does the UNPACK pragma work?

2011-10-28 Thread Simon Peyton-Jones
newtypes always turn into no code. The UNPACK is therefore asking to unpack the Integer inside a Day, and that we can't do because Integer has more than one data constructor. Ditto Pico. So just drop the UNPACKS. Keep the ! though, to keep it strict S From: haskell-cafe-boun...@haskell.org

[Haskell-cafe] Simon PJ in Australia

2011-08-19 Thread Simon Peyton-Jones
This is a message for Australian FPers -- sorry to spam the rest of you. I'm crossing the planet to Australia for YOW (Melbourne Dec 1-2, Brisbane Dec 5-6). http://www.yowconference.com.au/YOW2011/ I'm committed for the conference dates of course, but I could spend a few days before or afterwa

Re: [Haskell-cafe] FFI for a beginner

2011-07-14 Thread Simon Peyton-Jones
FIXED IT!!! The problem with charm.hs and its FFI dependency charm.c is that both want to produce an intermediary charm.o file. Solution: rename charm.hs to hscharm.hs. Would you (or anyone else) care to update the tutorials on the Haskell Wiki? As someone wrote below: While the tutorials at

Re: [Haskell-cafe] Proposal to incorporate Haskell.org

2011-05-11 Thread Simon Peyton-Jones
Dear haskell.org committee Great stuff. Thanks for getting this together. Things I wondered about are: - who will run the haskell.org entity? - how are they chosen? do they have fixed terms? - how are they accountable to the Haskell Community (eg an a brief an

Re: [Haskell-cafe] Template Haskell reified type.

2011-05-10 Thread Simon Peyton-Jones
Can you give a concrete example? There is code in GHC that is supposed to produce TupleT and ListT! Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On | Behalf Of Serguey Zefirov | Sent: 09 May 2011 14:43 | To: haskell | Sub

Re: [Haskell-cafe] mtlx has a nice design but is slow

2011-04-07 Thread Simon Peyton-Jones
GHC's goal is to be good enough at inlining and optimisation that you shouldn't take a performance hit for adding layers of abstraction. Sometimes it needs help (eg inlining pragmas). So as Don implies, it might be worth digging a bit to see where the performance hit comes from. Simon |

Re: [Haskell-cafe] Class constraints for associated type synonyms

2011-03-24 Thread Simon Peyton-Jones
| class Monoid (GeneratorOf a) => Generable a where | type GeneratorOf a :: * -> * | construct :: GeneratorOf a -> a | | Now, it seems I need FlexibleInstances to do this when I'm using an | associated type synonym, but I don't need the flexibility when using a | multiparameter type class.

[Haskell-cafe] Parallel Haskell stories

2011-03-09 Thread Simon Peyton-Jones
Friends I'm giving a talk at a developer conference in London on Friday 18th, about parallel programming in Haskell. http://skillsmatter.com/event/scala/functionalpx-2011/ad-1382 I know that some of you have been using Haskell for parallel or concurrent programming quite a bit, so this

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread Simon Peyton-Jones
What happens is this. From the (Foo Bool) instance GHC generates dFooBool :: Foo Bool dFooBool = DFoo fooBool barBool foo_barBool barBool :: Bool -> Bool barBool = not Now when GHC sees bar dFooBool it rewrites it to barBool Moreover there is currently no way to say "don't do th

[Haskell-cafe] The F# Team are Hiring

2011-01-24 Thread Simon Peyton-Jones
Dear Haskell'ers The F# team in Seattle/Redmond have an opening for a Senior Program Manager. A demonstrated love for applied Haskell/OCaml/F# programming would be highly regarded background experience :) We al

Re: [Haskell-cafe] Missing Functor instances in GHC 7?

2010-12-10 Thread Simon Peyton-Jones
| Interestingly, if I import only Control.Applicative from within GHCi, it | does not find the instances defined in Control.Monad.Instances although | this module is imported in Control.Applicative. On the other hand, if I | write a file containing the line 'import Control.Applicative' and load | t

RE: [Haskell-cafe] GHC 7.0.1 developer challenges

2010-11-29 Thread Simon Peyton-Jones
| The irony of this situation is deep. CPSA is a program that analyzes | cryptographic protocols in an effort to expose security flaws. To | ensure that the program does not crash a user's machine, I have to use | a linker option that may expose the user to some security problems. Do you have an

RE: [Haskell-cafe] Impredicative Types

2010-11-19 Thread Simon Peyton-Jones
read the QML paper! that's the trick. simpler, but with a heavier annotation burden than the more sophisticated approaches | -Original Message- | From: Gregory Crosswhite [mailto:gcr...@phys.washington.edu] | Sent: 19 November 2010 19:59 | To: Simon Peyton-Jones | Cc: Haskell

RE: [Haskell-cafe] Impredicative Types

2010-11-19 Thread Simon Peyton-Jones
Yes, impredicative types are still in, but in a simpler form than before, along the lines of QML http://research.microsoft.com/en-us/um/people/crusso/qml/ I have been too busy with getting the new type checker working to describe or document it. Notably, I have not yet added syntax for QML's ri

RE: [Haskell-cafe] Curious data family bug

2010-11-15 Thread Simon Peyton-Jones
Hmm. It works with HEAD (and hence I believe with the 7.0.1 RC2). It looks similar to http://hackage.haskell.org/trac/ghc/ticket/4174, which is fixed. Anyway I've added it as a regression test, so it should never go wrong again. Thanks for mentioning it. Simon | -Original Message- |

RE: [Haskell-cafe] Quasiquoter invocation no longer requires/allows a leading dollar sign.

2010-11-12 Thread Simon Peyton-Jones
Good point. I've done this. (Ian, could you merge) Fri Nov 12 08:30:52 GMT 2010 simo...@microsoft.com * Allow the old [$foo| ... |] syntax for quasi-quotes This is just a backward-compatibility thing, to be removed eventually. Simon | -Original Message- | From: haskell-cafe-bou

RE: [Haskell-cafe] ghc dump the code for derived instances

2010-11-11 Thread Simon Peyton-Jones
-ddump-deriv From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Ozgur Akgun Sent: 11 November 2010 14:27 To: Haskell cafe Subject: [Haskell-cafe] ghc dump the code for derived instances Café, Is there a way to make GHC dump the code for auto-derived ty

[Haskell-cafe] Splittable random numbers

2010-11-04 Thread Simon Peyton-Jones
exchange you get robust splitting. Does anyone feel like taking the idea and turning it into a Haskell library? (Or even a Haskell Wiki page?) I'm taking the liberty of cross-posting to the libraries list. Simon From: Burton Smith Sent: Tuesday, November 02, 2010 3:58 PM To: Simon Peyt

RE: [Haskell-cafe] Are newtypes optimised and how much?

2010-11-04 Thread Simon Peyton-Jones
| > The exact syntax is a problem (as usual). We have the technology now. The | question is how important it is. | | I think extending the syntax for contexts would be sufficient: | Write a ~~ b for "a can be converted to b by wrapping / unwrapping | newtypes", which is a conservative approximat

RE: [Haskell-cafe] Are newtypes optimised and how much?

2010-10-21 Thread Simon Peyton-Jones
| >> Yes, you can freely use Foo/unFoo. There's no runtime penalty. (In the | >> jargon of GHC's intermediate language, Foo and unFoo translate to | >> *type-safe casts*, which generate no executable code. | > | > When does the conversion to type-safe casts occur relative to other | > optimizations

RE: [Haskell-cafe] Are newtypes optimised and how much?

2010-10-20 Thread Simon Peyton-Jones
| At the end of the day what motivated me to ask these questions it that | I like very much defining newtypes for most of the types I use, I have | completely forgotten about `type' aliasing. I'm completely happy to | write Foo and unFoo all over the place to aid my type correctness, but | I w

[Haskell-cafe] Template Haskell: onward and upward

2010-10-18 Thread Simon Peyton-Jones
Folks Following lots of feedback from users, especially at ICFP, I've evolved some proposals for Template Haskell, that should make it both more expressive, and more secure. http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal Do let me know what you think. Discussion by ema

RE: [Haskell-cafe] try, seq, and IO

2010-09-15 Thread Simon Peyton-Jones
You may get useful help from Haskell Cafe. But if you can produce a cut-down example without complex dependencies, we could also look at it. Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe- | boun...@haskell.org] On Behalf Of Jeroen van Maanen |

RE: [Haskell-cafe] circular imports

2010-09-07 Thread Simon Peyton-Jones
I was under the impression that the main reason GHC requires .hs-boot files is that nobody has had the time or inclination to make it resolve circular dependencies automatically, and not an intentional design decision to encourage "good design". Indeed. I’ve added some notes here http://hackag

[Haskell-cafe] RE: [Haskell] Proposal: Form a haskell.org committee

2010-09-06 Thread Simon Peyton-Jones
Ian et al | To fix this problem, we propose that we create a "haskell.org | committee", which is responsible for answering these sorts of questions, | although for some questions they may choose to poll the community at | large if they think appropriate. I think that's an excellent idea. I think

[Haskell-cafe] FW: [TYPES/announce] CUFP 2010 Call for Participation

2010-08-27 Thread Simon Peyton-Jones
Dear Haskellers CUFP should be a lot of fun this year. Do consider going. Simon Commercial Users of Functional Programming Workshop (CUFP) 2010 Call for Participation Sponsored by SIGPLAN Co-located with ICF

RE: [Haskell-cafe] foreign function interface "Invalid type signature"

2010-08-26 Thread Simon Peyton-Jones
The HEAD now does FFI by default (Haskell 2010) so you would not have tripped over this. But even if you use the -XHaskell98 flag to recover Haskell-98 mode, you get this error: Foo.hs:9:1: Invalid type signature: foreign export ccall foo :: CInt -> CInt Perhaps you meant to use -XForeig

RE: [Haskell-cafe] Is there any experience using Software Transactional Memory in substantial applications?

2010-08-10 Thread Simon Peyton-Jones
| Recently we discussed Haskell and especially types in Russian part of | LiveJournal and of course we talk about STM. | | My opponent gave me that link: | http://logicaloptimizer.blogspot.com/2010/06/so-microsofts-experiments-with- | software.html | | It says that performance with STM in M

RE: [Haskell-cafe] Template Haskell sees into abstract data types

2010-07-28 Thread Simon Peyton-Jones
I assume you've seen http://hackage.haskell.org/trac/ghc/ticket/4222 There are non-obvious design choices here Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On | Behalf Of Serguey Zefirov | Sent: 28 July 2010 11:07 | To: Jon

RE: [Haskell-cafe] Template Haskell sees into abstract data types

2010-07-26 Thread Simon Peyton-Jones
| Data.Map.Map and Data.Set.Set are exported abstractly, without | exposing knowledge about their internal structure. | | I cannot directly create my own class instances for them because of | that. But I found that I can write Template Haskell code that could do | that - those data types cou

RE: [Haskell-cafe] Docs on the current and future constraint solver?

2010-07-15 Thread Simon Peyton-Jones
Corey | On 14 July 2010 18:39, Corey O'Connor wrote: | > I believe I have run headlong into issue #3064 in ghc | > (http://hackage.haskell.org/trac/ghc/ticket/3064). All I think I know | > is this: | > * this is a performance issue with the system used to solve type | constraints. | > * the solve

[Haskell-cafe] Fundeps and overlapping instances

2010-07-07 Thread Simon Peyton-Jones
Oleg points out, and Martin also mentions, that functional dependencies appear to interact OK with overlapping instances, but type families do not. I this impression is mistaken, and I'll try to explain why in this message, in the hope of exposing any flaws in my reasoning. We can't permit over

RE: [Haskell-cafe] checking types with type families

2010-07-07 Thread Simon Peyton-Jones
Martin Sulzmann, Jeremy Wazny, Peter J. Stuckey: A Framework for Extended Algebraic Data Types. FLOPS 2006

RE: [Haskell-cafe] Re: checking types with type families

2010-07-07 Thread Simon Peyton-Jones
| >> -- Does this typecheck? | >> f :: C a b => T a -> Bool | >> f T1 = True | >> f T2 = op 3 | > | >> The function f "should" typecheck because inside the T2 branch we know | >> that (a~Int), and hence by the fundep (b~Bool). | | Perhaps I'm confused, but there seems to be no lin

RE: [Haskell-cafe] checking types with type families

2010-07-01 Thread Simon Peyton-Jones
| Well, from looking at the documentation, it looks like I could maybe | use a type family if I could write: | | class (DerivedOf a ~ derived) => Typecheck a derived where | ... That's the right idiom yes. But see my message of a few minutes ago... It's neater still to remove the 'derived

RE: [Haskell-cafe] Inferring the most general type

2010-07-01 Thread Simon Peyton-Jones
I don't know an algorithm that can always infer the most general types in situations like this. In your example, if you give a signature for the simple function (f :: Y Maybe -> Int), and use RelaxedPolyRec, then GHC will happily infer the type you want for g. For RelaxedPolyRec to work its m

RE: [Haskell-cafe] checking types with type families

2010-07-01 Thread Simon Peyton-Jones
Claus | > I'm interested in situations where you think fundeps work | > and type families don't. Reason: no one knows how to make | > fundeps work cleanly with local type constraints (such as GADTs). | > | > If you think you have such as case, do send me a test case. | | Do you have a wik

RE: [Haskell-cafe] checking types with type families

2010-07-01 Thread Simon Peyton-Jones
| Here's a concrete case I recently ran into: | | type family SomeOtherTypeFamily a | class SomeClass a where type SomeType a | instance a ~ SomeOtherTypeFamily b => SomeClass a where |type SomeType a = (b,Int) |-- (error) Not in scope: type variable `b' | | The same thing

[Haskell-cafe] RE: proposal: HaBench, a Haskell Benchmark Suite

2010-06-25 Thread Simon Peyton-Jones
I'm delighted that you are interested in this benchmarking stuff. Much needed. Thank you! | So I still very much like the approach taken by the venerable nofib | suite where it includes not only the "real" programs, but also the | microbenchmarks and the small programs; you don't have to use th

RE: [Haskell-cafe] checking types with type families

2010-06-23 Thread Simon Peyton-Jones
| > I think your problem here is that there's no mention of `a' on the | > left-hand size of from_val's type signature; you either need to use | > MPTC+fundep to associate what result is compared to a, or else use a | > phantom type parameter of Val to make it "data Val result a = ..." and | > then

RE: [Haskell-cafe] Re: Data instance for a GADT

2010-05-25 Thread Simon Peyton-Jones
There have been a couple of emails about Template Haskell support for · GADTs · View patterns · Reifying instances There’s a ticket for this already http://hackage.haskell.org/trac/ghc/ticket/3497 It’s mainly a library design question, in this case the design of the Te

[Haskell-cafe] Modular type inference

2010-05-14 Thread Simon Peyton-Jones
Friends Many of you will know that I've been muttering about re-engineering GHC's type inference engine for some time now. Dimitrios, Tom, Martin and I have just completed an epic paper describing the Glorious New Framework that forms the substance of the above mutterings: http://haske

RE: [Haskell-cafe] Good US Grad schools for functional languages?

2010-05-14 Thread Simon Peyton-Jones
I'd also think of Harvard (Morrisset), Tufts (Ramsey), Portland State (Jones, Sheard), Yale (Hudak), North Eastern (Wand, Felleisen, Shivers), Utah (Flatt), Chicago (Reppy, MacQueen), North Western (Findler). Simon From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org

RE: [Haskell-cafe] GHC, odd concurrency space leak

2010-04-17 Thread Simon Peyton-Jones
I have not been following the details of this, I'm afraid, but I notice this: > forever' m = do _ <- m > forever' m When I define that version of forever, the space leak goes away. What was the old version of forever that led to the leak? If you can boil down the leak to a simpl

[Haskell-cafe] RE: No warning in GHC

2010-03-22 Thread Simon Peyton-Jones
[Redirecting to haskell-cafe] Try http://www.haskell.org/ghc/docs/latest/html/users_guide/flag-reference.html#id2959068 With -Wall I get bash-3.2$ ghc -c -Wall Foo.hs Foo.hs:3:0: Warning: Definition but no type signature for `func' Inferred type: func :: forall t t1. (Num t1)

RE: [Haskell-cafe] generalized newtype deriving allows the definition of otherwise undefinable functions

2010-03-09 Thread Simon Peyton-Jones
| some time ago, it was pointed out that generalized newtype deriving could be | used to circumvent module borders. Now, I found out that generalized newtype | deriving can even be used to define functions that would be impossible to define | otherwise. To me, this is surprising since I thought th

RE: [Haskell-cafe] Haskell platform for GHC 6.12.1?

2010-03-04 Thread Simon Peyton-Jones
See http://trac.haskell.org/haskell-platform/wiki/ReleaseTimetable The Haskell Platform for GHC 6.12 should be out on March 21st. Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On | Behalf Of Peter Verswyvelen | Sent: 04 M

RE: [Haskell-cafe] View patterns

2010-03-01 Thread Simon Peyton-Jones
| However, as somebody pointed out, the Java version is polymorphic. | Assuming that length() is defined for multiple types of container, the | Java version works with lists, arrays, sets, etc. If you try to do this | in Haskell, you end up with A standard way to do it would be this: class ListLi

RE: [Haskell-cafe] Non-termination due to context

2010-01-22 Thread Simon Peyton-Jones
It's a feature! You have * B is a superclass of A * Eq is a superclass of B So every A dictionary has a B dictionary inside it, and every B dictionary has an Eq dictionary inside it. Now, your instance declaration instance (A a, Eq a) => B a says "if you give me an A dictionary and

RE: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Simon Peyton-Jones
| > Hmm. If you have | > class (Diff (D f)) => Diff f where | > | > then if I have | > f :: Diff f => ... | > f = e | > then the constraints available for discharging constraints arising | > from e are | > Diff f | > Diff (D f) | > Diff (D (D f)) | > Diff (D (D (D f))) |

RE: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Simon Peyton-Jones
Hmm. If you have class (Diff (D f)) => Diff f where then if I have f :: Diff f => ... f = e then the constraints available for discharging constraints arising from e are Diff f Diff (D f) Diff (D (D f)) Diff (D (D (D f))) ... That's a lo

RE: [Haskell-cafe] When are undecidables ok?

2009-12-07 Thread Simon Peyton-Jones
I don’t think it’s all that complicated or fragile. To resolve the constraint (C T1 T2), use the appropriate instance declaration to express it in terms of (hopefully simpler) constraints. Keep doing that. If you terminate, GHC should. Example: to resolve Eq [Int], use the instance declaratio

RE: [Haskell-cafe] Is Haskell a Fanatic?

2009-12-04 Thread Simon Peyton-Jones
Friends One of the absolutely best things about the Haskell community is that it is almost invariably respectful and usually friendly. People often remark on this when they join the community. Beginner questions are greeted with polite and helpful replies. Category theory and elementary type

RE: [Haskell-cafe] Monomorphic local let bindings and GHCi

2009-12-04 Thread Simon Peyton-Jones
| So I think that if local let generalisation is abandoned, let bindings in GHCi | would somehow have to be modified to remain polymorphic. I agree. They are like top-level bindings in a Haskell module, and should be generalised. They don't suffer from the problems of generalising nested bindi

RE: [Haskell-cafe] Type synonym family inside type class

2009-12-02 Thread Simon Peyton-Jones
I agree this is wrong. I've created a Trac bug report http://hackage.haskell.org/trac/ghc/ticket/3714 Thanks for pointing it out Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe- | boun...@haskell.org] On Behalf Of Martijn van Steenbergen | Sent:

RE: [Haskell-cafe] Pointfree rank-2 typed function

2009-11-25 Thread Simon Peyton-Jones
| Are there workarounds for uses of impredicative types, or do we lose the | ability to express certain programs as a result? There's usually a workaround. I include the msg I sent below. Simon -Original Message- From: Simon Peyton-Jones Sent: 30 October 2009 09:52 To: GHC use

RE: [Haskell-cafe] Pointfree rank-2 typed function

2009-11-24 Thread Simon Peyton-Jones
It used to be, because GHC used to implement so-called "deep skolemisation". See Section 4.6.2 of http://research.microsoft.com/en-us/um/people/simonpj/papers/higher-rank/putting.pdf Deep skolemisation was an unfortunate casualty of the push to add impredicative polymoprhism. However, as I men

RE: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-20 Thread Simon Peyton-Jones
| > * General Type Directed Name Resolution (GTDNR): | > For every function application "f x" in the program where "f" is a | > name, "f" is resolved based on the type of the argument "x". | > ... | You suggest that GTDNR might not be a good idea, well why not? One | reason is that it

RE: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-19 Thread Simon Peyton-Jones
| The proposal has this sentence, apparently in reference to using | qualified imports: "This is sufficient, but it is just sufficiently | inconvenient that people don't use it much." Does this mean qualified | imports? I clarified. | One thing I'd really like that this would provide is shorter

RE: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-18 Thread Simon Peyton-Jones
| > Each 'foo' gives a type instance for TDNR_foo, mapping the type of the first | argument to the type of that foo. | | Hmm... GHC doesn't allow this: | | type instance TDNR_foo () = forall a. () -> a -> a | | IIUC this restriction is necessary to guarantee termination. Given your analogy, | w

RE: [Haskell-cafe] GHCi's :t misbehaving

2009-11-18 Thread Simon Peyton-Jones
Are you wanting the type of a variable? You probably want :i What is the actual type of the variable? Or is it an expression? Without more info it's hard to help. You should be able to make a repo case without all the supporting code by defining thing1 :: thing1 = error "urk" and so on for

RE: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-18 Thread Simon Peyton-Jones
It's always tempting to spend a lot of time on syntax, but in this case it may be justified. Syntactic brevity is a good part of the point of TDNR. And I'm on a train which is a good time to argue about syntax. Personally I think there are strong advantages to ".": * For record selectors, cu

RE: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-18 Thread Simon Peyton-Jones
| Simon, have you given any thought to how this interacts with type system | extensions, in particular with GADTs and type families? The proposal relies | on being able to "find the type" of a term but it's not entirely clear to me | what that means. Here is an example: | | foo :: F Int -> Int | f

RE: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-17 Thread Simon Peyton-Jones
-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On | Behalf Of Luke Palmer | Sent: 17 November 2009 17:08 | To: Simon Peyton-Jones | Cc: Levi Greenspan; Haskell Cafe | Subject: Re: [Haskell-cafe] Status of TypeDirectedNameResolution proposal? | | On Tue, Nov 17, 2009 at 5:18 AM, Simon Peyton-

FW: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-17 Thread Simon Peyton-Jones
[Resending, this time with link; sorry] | What's the status of the TDNR proposal [1]? Personally I think it is a | very good idea and I'd like to see it in Haskell'/GHC rather sooner | than later. Working around the limitations of the current record | system is one of my biggest pain points in Has

RE: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-17 Thread Simon Peyton-Jones
| What's the status of the TDNR proposal [1]? Personally I think it is a | very good idea and I'd like to see it in Haskell'/GHC rather sooner | than later. Working around the limitations of the current record | system is one of my biggest pain points in Haskell and TDNR would be a | major improvem

RE: [Haskell-cafe] The weirdest error I've ever seen...

2009-11-13 Thread Simon Peyton-Jones
nnecessary stuff, to get it as small as possible. Thanks Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On | Behalf Of Joe Fredette | Sent: 12 November 2009 18:12 | To: Joe Fredette | Cc: Simon Peyton-Jones; Haskell Cafè | S

RE: [Haskell-cafe] The weirdest error I've ever seen...

2009-11-12 Thread Simon Peyton-Jones
| [1 of 3] Compiling Network.HackMail.Email.ParseEmail ( Network/ | HackMail/Email/ParseEmail.hs, interpreted ) | [2 of 3] Compiling Network.HackMail.Email.Email ( Network/HackMail/ | Email/Email.hs, interpreted ) | [3 of 3] Compiling Network.HackMail.Filter.Filter ( Network/HackMail/ | Filter/Filt

  1   2   3   4   5   6   7   >