Re: [Haskell-cafe] Proposal: Polymorphic typeclass and Records

2013-08-29 Thread Adam Gundry
Hi, On 28/08/13 21:05, Wvv wrote: Let we have data in one module as this: data Person = Person { personId :: Int, name :: String } data Address a = Address { personId :: Int, address :: String , way :: a} It was discussed a lot in topics OverloadedRecordFields This is

Re: [Haskell-cafe] typeclass constraints

2013-08-23 Thread Adam Gundry
Hi TP, The difference is that in your second example, you have specified the type signature p :: a - ExpQ so GHC checks whether p has this type, and correctly objects that it doesn't. If you leave off the type signature, as you did for sum', the right thing will be inferred. Hope this helps,

Re: [Haskell-cafe] Alternative name for return

2013-08-06 Thread Adam Gundry
Hi, On 06/08/13 06:14, J. Stutterheim wrote: Suppose we now have the opportunity to change the name of the `return` function in Monad, what would be a better name for it? (for some definition of better) Rather than proposing a different name, I'm going to challenge the premise of your

Re: [Haskell-cafe] Product-Categories

2013-07-04 Thread Adam Gundry
Hi, On 04/07/13 02:19, Lyndon Maydwell wrote: I'm wracking my brain trying to figure out a simple, reasonably general, implementation for a category instance for pairs of categories. So far I've looked at [1], which seems great, but doesn't use the built-in category instance, and [2], which

Re: [Haskell-cafe] DSL to English and back for game rule set?

2013-05-20 Thread Adam Gundry
In case you haven't seen it already, you might be interested in Inform (http://inform7.com/), which is a DSL for interactive fiction (aka text adventures) using natural language. Cheers, Adam On 19/05/13 21:27, Matthew O'Connor wrote: Hello all, I recognize this isn't directly a

Re: [Haskell-cafe] Stuck on design problem

2013-05-20 Thread Adam Gundry
Hi Nicolas, Your design doesn't look too unreasonable, though I haven't looked at in detail. I do have a quick observation regarding the implementation that I hope might help. Your gist defines class MonadLog m a where getEntry :: Index - m (Entry a) instance MonadLog (MemLog a) a and

Re: [Haskell-cafe] question about GADT and deriving automatically a Show instance

2013-05-17 Thread Adam Gundry
Hi TP, On 17/05/13 15:32, TP wrote: | [...] | | So I modify my code by removing deriving Show, and adding the line: | | instance Show (Person gender) | | | But now, I obtain: | | $ runghc test_show.hs | GHC stack-space overflow: current

Re: [Haskell-cafe] Typeclass with an ‘or’ restriction.

2013-05-10 Thread Adam Gundry
Hi Mateusz, It's not directly possible to write a class with a choice of superclasses; as you point out, it's not really clear what that would mean. One workaround, though it might not be sensible in practice, is the following. {-# LANGUAGE ConstraintKinds, GADTs #-} First, reify the

Re: [Haskell-cafe] Diving into the records swamp (possible GSoC project)

2013-04-27 Thread Adam Gundry
Hi AntC, Thanks for the feedback! On 26/04/13 09:55, AntC wrote: Adam Gundry adam.gundry at strath.ac.uk writes: Hi, I am hoping to do a GSoC project this year working on GHC, and have been pointed in the direction of the records issue (in particular, the desire to overload field names

Re: [Haskell-cafe] Diving into the records swamp (possible GSoC project)

2013-04-27 Thread Adam Gundry
Hi Petr, On 26/04/13 19:53, Petr Pudlák wrote: Hi Adam, very nice idea. As the others, I'm curious why you chose to implement SORF in favor of the other ideas? As I've commented in a message just now [1], by mentioning SORF I didn't mean to exclude taking on board the other proposals

Re: [Haskell-cafe] Diving into the records swamp (possible GSoC project)

2013-04-27 Thread Adam Gundry
Hi Johan, On 26/04/13 20:46, Johan Tibell wrote: Hi Adam, Since we have already had *very* long discussions on this topic, I'm worried that I might open a can of worms be weighing in here, but the issue is important enough to me that I will do so regardless. I'm the one busily opening

[Haskell-cafe] Diving into the records swamp (possible GSoC project)

2013-04-26 Thread Adam Gundry
a PhD student working on type inference for Haskell and dependent types, with about four years' Haskell experience including work on big type-system related projects. I am familiar with the theory behind GHC, but I haven't worked on the code before.) Thanks, Adam Gundry [1] http

Re: [Haskell-cafe] Type-directed functions with data kinds

2012-10-26 Thread Adam Gundry
Hi Paul, On 25/10/12 16:22, Paul Visschers wrote: Hello everyone, I've been playing around with the data kinds extension to implement vectors that have a known length at compile time. Some simple code to illustrate: [...] In this code I have defined a repeat function that works in a