Re: faking universal quantification in constraints

2012-04-17 Thread Edward Kmett
On Tue, Apr 17, 2012 at 6:40 PM, Nicolas Frisby wrote: > I built a (really ugly) dictionary for (Int ~ Char) using > Data.Constraints.Forall. I'm fairly confident it could be generalized > to a polymorphic coercion (a ~ b). > > http://hpaste.org/67180 > > I cheated with overlapping instances, but

Re: faking universal quantification in constraints

2012-04-17 Thread Edward Kmett
On Mon, Apr 16, 2012 at 6:57 PM, Nicolas Frisby wrote: > I'm simulating skolem variables in order to fake universal > quantification in constraints via unsafeCoerce. > > http://hpaste.org/67121 > > I'm not familiar with various categories of types from the run-time's > perspective, but I'd be sur

Re: Boxed foreign prim

2012-03-13 Thread Edward Kmett
On Tue, Mar 13, 2012 at 4:57 AM, Simon Marlow wrote: > On 12/03/2012 14:22, Edward Kmett wrote: > >> On Mon, Mar 12, 2012 at 6:45 AM, Simon Marlow > <mailto:marlo...@gmail.com>> wrote: >>But I can only pass unboxed types to foreign prim. >> >>

Re: Boxed foreign prim

2012-03-12 Thread Edward Kmett
On Mon, Mar 12, 2012 at 6:45 AM, Simon Marlow wrote: > But I can only pass unboxed types to foreign prim. >> >> Is this an intrinsic limitation or just an artifact of the use cases >> that have presented themselves to date? >> > > It's an intrinsic limitation - the I# box is handled entirely at t

Boxed foreign prim

2012-03-08 Thread Edward Kmett
I'm currently working with a lot of very short arrays of fixed length and as a thought experiment I thought I would try to play with fast numeric field accessors In particular, I'd like to use something like foreign prim to do something like > foreign import prim "cmm_getField" unsafeField# :: a

Re: Holes in GHC

2012-02-18 Thread Edward Kmett
Not sure if I misparsed your response or not. Its not just things that can or could match the type of the scope, but basically anything introduced in local scopes around the hole, those can have types that you can't talk about outside of a local context, due to existentials that were opened, etc.

Re: Changes to Typeable

2012-02-14 Thread Edward Kmett
On Tue, Feb 14, 2012 at 11:18 AM, Iavor Diatchki wrote: > Hello, > > On Mon, Feb 13, 2012 at 5:32 PM, Edward Kmett wrote: >> >> There are fewer combinators from commonly used classes for working with >> the left argument of a bifunctor, however. >> > > I

Re: Changes to Typeable

2012-02-14 Thread Edward Kmett
Sent from my iPhone On Feb 14, 2012, at 3:00 AM, Roman Leshchinskiy wrote: > On 13/02/2012, at 11:10, Simon Peyton-Jones wrote: > >> | Should there perhaps be a NewTypeable module which could then be renamed >> | into Typeable once it is sufficiently well established? >> >> I started with

Re: Changes to Typeable

2012-02-13 Thread Edward Kmett
On Mon, Feb 13, 2012 at 3:27 PM, Simon Marlow wrote: > On 13/02/12 18:16, Edward Kmett wrote: > >> You could probably get away with something like >> >> data Proxy = Proxy a >> >> class Typeable a where >> typeOfProxy :: Proxy a -> TypeRep >>

Re: Changes to Typeable

2012-02-13 Thread Edward Kmett
You could probably get away with something like data Proxy = Proxy a class Typeable a where typeOfProxy :: Proxy a -> TypeRep typeOf :: forall a. Typeable a => a -> TypeRep typeOf = typeOfProxy (Proxy :: Proxy a) which being outside of the class won't contribute to the inference of 'a's kind.

Re: Changes to Typeable

2012-02-11 Thread Edward Kmett
In practice I've found that working with Tagged is a huge pain relative to working with Proxy. You usually need to use ScopedTypeVariables or do asTypeOf/asArgOf tricks that are far more complicated than they need to be. For reference you can compare the internals of reflection before when it use

Re: Type operators in GHC

2012-01-18 Thread Edward Kmett
I can live with it and I probably have as many packages as anyone that will be broken by it. =/ Things like http://hackage.haskell.org/packages/archive/categories/0.58.0.5/doc/html/src/Control-Category-Cartesian-Closed.html will need a pretty invasive rewrite, but the simplicity is worth it, an

Re: DefaultSignatures and MultiParamTypeClasses

2012-01-17 Thread Edward Kmett
Great! This will greatly reduce the boilerplate in the constraints package. Sent from my iPhone On Jan 16, 2012, at 9:15 AM, Simon Peyton-Jones wrote: > | /tmp/Test.hs:4:1: > | The multi-parameter class `C' cannot have generic methods > | In the class declaration for `C' > > Aha.

Re: renamed GMP symbols in GHC

2012-01-09 Thread Edward Kmett
P, however. Or rather, if it does, the methodology it would lead to would be one of bringing over all of their internals into Haskell. ;) -Edward Kmett ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: ConstraintKinds and default associated empty constraints

2012-01-09 Thread Edward Kmett
On Sun, Jan 8, 2012 at 8:32 AM, Bas van Dijk wrote: > On 23 December 2011 17:44, Simon Peyton-Jones > wrote: > > My attempt at forming a new understanding was driven by your example. > > > > class Functor f where > >type C f :: * -> Constraint > >type C f = () > > > > sorry -- that was s

Re: ConstraintKinds and default associated empty constraints

2011-12-23 Thread Edward Kmett
On Fri, Dec 23, 2011 at 10:17 AM, Simon Peyton-Jones wrote: > Right now it seems it is either * or Constraint depending on context. *** > * > > ** ** > > Correct. Tuple bracket are used for both types and Constraints, and we > have to decide which from context. > > ** > Whew, that agrees

Re: ConstraintKinds and default associated empty constraints

2011-12-23 Thread Edward Kmett
to:glasgow-haskell-users-boun...@haskell.org] On Behalf Of Edward Kmett > Sent: 22 December 2011 17:03 > To: Bas van Dijk > Cc: glasgow-haskell-users@haskell.org > Subject: Re: ConstraintKinds and default associated empty constraints > > On Wed, Dec 21, 2011 at 6:45 PM, Bas van

Re: 7.4.1-pre: Show & Integral

2011-12-22 Thread Edward Kmett
7.0.x agrees with the standard. The change, however, was a deliberate _break_ with the standard that passed through the library review process a few months ago, and is now making its way out into the wild. The simplest fix is to simply add an Eq or Show constraint to the few functions that ne

Re: ConstraintKinds and default associated empty constraints

2011-12-22 Thread Edward Kmett
On Wed, Dec 21, 2011 at 6:45 PM, Bas van Dijk wrote: > I'm playing a bit with the new ConstraintKinds feature in GHC > 7.4.1-rc1. I'm trying to give the Functor class an associated > constraint so that we can make Set an instance of Functor. The > following code works but I wonder if the trick wi

Re: Why not allow empty record updates?

2011-11-15 Thread Edward Kmett
Sent from my iPad On Nov 15, 2011, at 7:18 PM, wren ng thornton wrote: > On 11/15/11 12:33 PM, Yitzchak Gale wrote: >> Simon Peyton-Jones wrote: >> Trouble is, what type does this have? >> f x = x {} >> >> Malcolm Wallace wrote: > f :: a -> a >> >> Ian Lynagh wrote: That

Re: Records in Haskell

2011-11-07 Thread Edward Kmett
Ian said >class Has (r :: *) (ft :: *) (f :: ft) (t :: *) where > (where ft stands for field type)? > class Has (r :: *) (f :: ft) (t :: *) where would be my understanding of how it would be phrased under the current polymorphic kind system. This could also solve the representation-hidi

Re: Records in Haskell

2011-11-07 Thread Edward Kmett
On Mon, Nov 7, 2011 at 1:33 PM, Wolfgang Jeltsch wrote: > Am Montag, den 07.11.2011, 18:16 +0100 schrieb Claus Reinke: > > > I am unsure which of this list of proposals you are referring to. The > > > URL you quote is this > > > http://hackage.haskell.org/trac/haskell-prime/wiki/FirstClassLabels

Re: C, GCL interface

2011-11-01 Thread Edward Kmett
The major concern that I would have is that if GCL or any of those math libraries uses GMP behind the scenes, which they probably do, then things will just start crashing on you, because GHC hooks the GMP allocator and will just start making the limbs of their numbers disappear. -Edward On Tue, N

Re: deep record update

2011-09-19 Thread Edward Kmett
If you use lenses you can do this today with no real need to adulterate the parser. setL (l2 . l1) x rec This goes one step further as it can be written point free so you don't even have to give rec a name if you don't want to. ;) -Edward On Mon, Sep 19, 2011 at 9:09 AM, Barney Hilken wrote: >

Re: Parallel --make (GHC build times on newer MacBook Pros?)

2011-09-01 Thread Edward Kmett
On Thu, Sep 1, 2011 at 8:49 AM, Simon Marlow wrote: > On 01/09/2011 08:44, Evan Laforge wrote: > >> Yes, the plan was to eventually have a parallel --make mode. >>> >> >> If that's the goal, wouldn't it be easier to start many ghcs? >> > > It's an interesting idea that I hadn't thought of. There

Re: What are the preconditions of newArray#

2011-08-22 Thread Edward Kmett
It would still be nice to have a consistent base case. On Mon, Aug 22, 2011 at 3:43 AM, Johan Tibell wrote: > On Mon, Aug 22, 2011 at 5:55 AM, Edward Z. Yang wrote: > > stg_newArrayzh in rts/PrimOps.cmm doesn't appear to give any indication, > > so this might be a good patch to add. But I'm cur

Re: Superclass Cycle via Associated Type

2011-07-25 Thread Edward Kmett
On Mon, Jul 25, 2011 at 1:40 PM, Jacques Carette wrote: > ** > On 25/07/2011 9:55 AM, Edward Kmett wrote: > > If you have an associative (+), then you can use (.*) to multiply by a > whole number, I currently do fold a method into the Additive class to > 'fake' a

Re: Superclass Cycle via Associated Type

2011-07-25 Thread Edward Kmett
2011/7/25 Gábor Lehel > > type family Frozen t > > type family Thawed t > > class Immutable (Frozen t) => Mutable t where > > thawedFrozen :: t -> Thawed (Frozen t) > > unthawedFrozen :: Thawed (Frozen t) -> t > > > > class Mutable (Thawed t) => Immutable t where > > frozenThawed :: t -> Fr

Re: Superclass Cycle via Associated Type

2011-07-25 Thread Edward Kmett
On Mon, Jul 25, 2011 at 4:46 AM, Simon Peyton-Jones wrote: > On further reflection I have a question. > > ** ** > > Under the limited design below, which Edward says will do all he wants:*** > * > > **· **The mutually recursive classes (call them A, B, C) must be > defined all togethe

Re: Superclass Cycle via Associated Type

2011-07-23 Thread Edward Kmett
2011/7/23 Gábor Lehel > 2011/7/22 Dan Doel : > > 2011/7/22 Gábor Lehel : > >> Yeah, this is pretty much what I ended up doing. As I said, I don't > >> think I lose anything in expressiveness by going the MPTC route, I > >> just think the two separate but linked classes way reads better. So > >> i

Re: Superclass Cycle via Associated Type

2011-07-22 Thread Edward Kmett
2011/7/22 Simon Peyton-Jones > I talked to Dimitrios. Fundamentally we think we should be able to handle > recursive superclasses, albeit we have a bit more work to do on the type > inference engine first. > > The situation we think we can handle ok is stuff like Edward wants (I've > removed all

Re: Superclass Cycle via Associated Type

2011-07-21 Thread Edward Kmett
y unsatisfying because the Natural and Integer multiplication become horrific, and I wind up having to multiply the code below this point in the hierarchy to deal with the 'self algebra' cases. =/ I've also run into the problem about once or twice a year when encoding other concepts t

<    1   2