Re: [Haskell-cafe] TypeLits Typeable

2013-08-26 Thread José Pedro Magalhães
Hi Nicolas, It's not intentional, but Iavor is aware of this, and we want to change it. I'm CC-ing him as he might know more about what the current plan is. Cheers, Pedro On Sat, Aug 24, 2013 at 3:20 PM, Nicolas Trangez nico...@incubaid.comwrote: Hello Cafe, I was playing around with

Re: [Haskell-cafe] Rank N Kinds

2013-07-29 Thread José Pedro Magalhães
Hi, On Fri, Jul 26, 2013 at 10:42 PM, Wvv vite...@rambler.ru wrote: First useful use is in Typeable. In GHC 7.8 class Typeable (a::k) where ... == class Typeable (a ::**) where ... But we can't write data Foo (a::k)-(a::k)-* ... deriving Typeable Why not? This works fine in 7.7, as far

Re: [Haskell-cafe] Typeable typeclass and type-level naturals

2013-06-06 Thread José Pedro Magalhães
Hi, On Wed, Jun 5, 2013 at 11:21 PM, TP paratribulati...@free.fr wrote: José Pedro Magalhães wrote: Oh, it should probably be simply deriving instance Typeable 'Zero deriving instance Typeable 'Succ Yes, that's how it should be. Please let me know if that doesn't work

Re: [Haskell-cafe] Typeable typeclass and type-level naturals

2013-06-05 Thread José Pedro Magalhães
On Wed, Jun 5, 2013 at 8:46 AM, Roman Cheplyaka r...@ro-che.info wrote: * TP paratribulati...@free.fr [2013-06-05 00:37:36+0200] Roman Cheplyaka wrote: Try adding deriving instance Typeable 'Zero deriving instance Typeable a = Typeable ('Succ a) to your module. (I

Re: [Haskell-cafe] Derving NFData via Generics from a type that has a vector doesn't work. (was trying to understand out of memory exceptions)

2013-04-16 Thread José Pedro Magalhães
What is the error that you get? Cheers, Pedro On Tue, Apr 16, 2013 at 8:07 PM, Anatoly Yakovenko aeyakove...@gmail.comwrote: -- ok, something in deriving NFData using Generics in a type that has a Vector in it. {-# LANGUAGE DeriveGeneric #-} import Control.DeepSeq import System.IO

Re: [Haskell-cafe] Which generic zipper? [RESOLVED]

2013-04-11 Thread José Pedro Magalhães
Hi Luke, Even though you might have made up your mind already, here's some more info. If you want a zipper that does not use Typeable (and thus runtime type comparison and casting, which are potentially inefficient), you can use the zipper in Multirec [1]. Creating a zipper based on GHC.Generics

Re: [Haskell-cafe] Optimizing Fold Expressions

2013-03-30 Thread José Pedro Magalhães
Hi, Actually, if you really want folds, you should use regular [1] instead. Here's an example of a generic fold using regular: -- Datatype representing logical expressions data Logic = Var String | Logic :-: Logic -- implication | Logic :-: Logic -- equivalence

Re: [Haskell-cafe] Some aggregation of Haskell content

2013-03-18 Thread José Pedro Magalhães
On Mon, Mar 18, 2013 at 9:56 AM, Christopher Done chrisd...@gmail.comwrote: As a follow up, here's an implementation: http://haskellnews.org/ Could it have an RSS feed? Thanks, Pedro More info here: http://www.reddit.com/r/haskell/comments/1ahgrn/haskell_news/c8xfp9s On 10 February

Re: [Haskell-cafe] GHC.Generics and newtypes

2013-01-27 Thread José Pedro Magalhães
Hi Roman, Yes, the automatic derivation of Generic instances does not see through newtypes. Cheers, Pedro On Sun, Jan 27, 2013 at 8:17 PM, Roman Cheplyaka r...@ro-che.info wrote: Hi, Is it possible to generate different instances for newtypes and datatypes using GHC.Generics? Roman

Re: [Haskell-cafe] GHC.Generics and newtypes

2013-01-27 Thread José Pedro Magalhães
clear. What I want is somehow to find out whether the type under consideration is declared using data or newtype. Is it possible? Roman * José Pedro Magalhães j...@cs.uu.nl [2013-01-27 20:29:52+] Hi Roman, Yes, the automatic derivation of Generic instances does not see through

Re: [Haskell-cafe] Non-derivable Typeable

2013-01-22 Thread José Pedro Magalhães
Won't it derive it with StandaloneDeriving? Cheers, Pedro On Tue, Jan 22, 2013 at 1:28 PM, Roman Cheplyaka r...@ro-che.info wrote: I need to declare a Typeable instance for a type which has an argument of kind * - *. GHC refuses to derive it. What is a recommended way to go about it? In

Re: [Haskell-cafe] Non-derivable Typeable

2013-01-22 Thread José Pedro Magalhães
Yes, that will work. But soon we'll have poly-kinded Typeable in HEAD, which will be able to derive that instance. Cheers, Pedro On Tue, Jan 22, 2013 at 2:34 PM, Roman Cheplyaka r...@ro-che.info wrote: I just found mkTyCon3 which generates the fingerprint automatically. (I was looking at

Re: [Haskell-cafe] Chordify, a new web startup using Haskell

2013-01-19 Thread José Pedro Magalhães
Hi all, Thanks for all the feedback and kind words. Yes, we're planning to have export to PDF/midi options soon. We have plenty of ideas, but limited time :-/ User feedback is collected (and voted for) on https://chordify.uservoice.com/ Thanks, Pedro On Fri, Jan 18, 2013 at 12:37 PM, Rustom

[Haskell-cafe] Chordify, a new web startup using Haskell

2013-01-17 Thread José Pedro Magalhães
at this stage, so if you're interested in music and could use an automatic chord transcription service, please try Chordify! Cheers, Pedro [1] http://chordify.net/ [2] http://hackage.haskell.org/package/HarmTrace [3] José Pedro Magalhães and W. Bas de Haas. Functional Modelling of Musical Harmony

Re: [Haskell-cafe] Navigating 'Strategic' programming babel

2012-12-17 Thread José Pedro Magalhães
Hi Ravi, You might want to browse through Comparing Libraries for Generic Programming in Haskell: http://www.cs.uu.nl/research/techreps/repo/CS-2008/2008-010.pdf SYB and Uniplate are two widely used and well-maintained systems for strategic traversals over arbitrary datatypes. There are other

Re: [Haskell-cafe] How is default method signatures supposed to be used together with Generics

2012-12-12 Thread José Pedro Magalhães
Hi Johan, The error message is not ideal, but it does say that adding a Generic (Foo a) instance might solve the problem. I generally do not export classes like GHashable because they are closed; users should never need to provide more instances themselves. Also, exporting the class won't make

Re: [Haskell-cafe] Variable-arity zipWith (re)invented.

2012-12-11 Thread José Pedro Magalhães
Hi Takayuki, Just thought I'd mention another approach to a variadic zipWith, this one using type families: http://typesandkinds.wordpress.com/2012/11/26/variable-arity-zipwith/ The current lack of overlap in type families makes things a bit more complicated, but it can be solved using the

Re: [Haskell-cafe] [Security] Put haskell.org on https

2012-10-28 Thread José Pedro Magalhães
+1 Pedro On Sun, Oct 28, 2012 at 12:20 AM, Niklas Hambüchen m...@nh2.me wrote: (I have mentioned this several times on #haskell, but nothing has happened so far.) Are you aware that all haskell.org websites (hackage, HaskellWiki, ghc trac) allow unencrypted http connections only? This

Re: [Haskell-cafe] Problems translating Conor McBride's talk into Haskell + DataKind + KindPoly

2012-10-26 Thread José Pedro Magalhães
Hi, Please use GHC 7.6 for experimenting with PolyKinds/DataKinds; the implementation in 7.4 was not fully complete. Your code compiles fine in 7.6. Cheers, Pedro On Fri, Oct 26, 2012 at 3:10 AM, Ahn, Ki Yung kya...@gmail.com wrote: Promotion works for user defined lists such as data List

[Haskell-cafe] createProcess fails to find executable in Windows

2012-10-25 Thread José Pedro Magalhães
Hi all, Consider the following program: module Test where import System.Process (readProcess) main :: IO () main = readProcess git [describe, --tags] = putStr In Windows I get the following behaviour: git --version git version 1.7.10.msysgit.1 ghc --version The Glorious Glasgow

Re: [Haskell-cafe] createProcess fails to find executable in Windows

2012-10-25 Thread José Pedro Magalhães
echo %PATH%` it shows me the expected %PATH%, including the directory where the git binary lives. Thanks, Pedro On Thu, Oct 25, 2012 at 10:05 PM, José Pedro Magalhães j...@cs.uu.nlwrote: Hi all, Consider the following program: module Test where import System.Process (readProcess) main

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

2012-10-25 Thread José Pedro Magalhães
Hi Paul, On Thu, Oct 25, 2012 at 4:22 PM, Paul Visschers m...@paulvisschers.netwrote: 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: {-# LANGUAGE DataKinds, GADTs,

Re: [Haskell-cafe] Transforming a ADT to a GADT

2012-09-16 Thread José Pedro Magalhães
Hi Florian, Will this do? class Tc a where tc :: Exp - Maybe (Term a) instance Tc Int where tc (Lit i) = return (TLit i) tc (Succ i) = tc i = return . TSucc tc (IsZero i) = Nothing tc e= tcIf e instance Tc Bool where tc (Lit i) = Nothing tc (Succ i)

Re: [Haskell-cafe] explicit annotations on kind polymorphism for data types

2012-08-22 Thread José Pedro Magalhães
Nope, but it should work on 7.6 (also on the release candidate). The 'X' should be lowercase, though, like type variables. Cheers, Pedro On Wed, Aug 22, 2012 at 12:01 AM, dude d...@methodeutic.com wrote: Hello All: I'm working through Giving Haskell a Promotion. Section 2.4 presents an

Re: [Haskell-cafe] [Haskell] [ANN] GenCheck - a generalized property-based testing framework

2012-06-23 Thread José Pedro Magalhães
On Tue, Jun 19, 2012 at 4:04 PM, Jacques Carette care...@mcmaster.cawrote: User beware: this is gencheck-0.1, there are still a few rough edges. We plan to add a Template Haskell feature to this which should make deriving enumerators automatic for version 0.2. Can you provide me a quick

Re: [Haskell-cafe] class instances for kinds with finite ty constrs, does this make sense?

2012-06-07 Thread José Pedro Magalhães
Hi, This has been discussed before: http://haskell.1045720.n5.nabble.com/Data-Kinds-and-superfluous-in-my-opinion-constraints-contexts-td5689436.html Feel free to open a feature request for this. I think it's something we should consider addressing, but at the moment it's not immediately clear

Re: [Haskell-cafe] Bug in SYB, SYB-documentation or GHC-API (or I messed up somewhere)

2012-05-13 Thread José Pedro Magalhães
Hi Philip, On Fri, May 11, 2012 at 5:12 PM, Philip K. F. Hölzenspies p...@st-andrews.ac.uk wrote: However, it turns out that this never leads to an evaluation of extTyNamesLoc. I've come as far as to see that, since Located a is a synonym for GenLocated SrcSpan a, the type we're looking for

Re: [Haskell-cafe] Annotaing abstract syntax trees

2012-05-09 Thread José Pedro Magalhães
Hi Romildo, I had a quick look at your code. In general it seems fine, although I haven't tested it. You might want to use HLint to give you coding tips. I don't understand your remark about wanting the type checker to produce an expression annotated with both positions and calculated types.

Re: [Haskell-cafe] Annotations in abstract syntax tree

2012-04-26 Thread José Pedro Magalhães
Hi Romildo, If I understand correctly, you now want to add annotations to mutually-recursive datatypes. The annotations package supports that. Section 8 of our paper [1] gives an example of how to do that, and also Chapter 6 of Martijn's MSc thesis [2]. Let me know if these references do not

Re: [Haskell-cafe] Prettier pretty-printing of data types?

2012-03-14 Thread José Pedro Magalhães
Hi, On Wed, Mar 14, 2012 at 07:54, Johan Holmquist holmi...@gmail.com wrote: I guess you want an automatically derived show that indents, but if you don't mind defining you own, Data.PrettyPrint is really nice. Though most likely any form of pretty-printing will be generic, and can be

Re: [Haskell-cafe] Helper classes for Generics

2012-03-12 Thread José Pedro Magalhães
Hi Reiner, It is indeed not strictly necessary to define such helper classes for kind * generic functions. You do need them for kind * - * functions, though. Also, I think they should always be used because they help keep things separate. If we use an implementation of generics with DataKinds

Re: [Haskell-cafe] Helper classes for Generics

2012-03-12 Thread José Pedro Magalhães
Hi Yves, GHC.Generics [1] and SYB [2] are two rather different approaches to generic programming. There are things that can be done in one but not in the other, and there are things that are easier on one rather than the other. For instance, SYB tends to be very useful for large AST

Re: [Haskell-cafe] Helper classes for Generics

2012-03-12 Thread José Pedro Magalhães
Data have been used for generic Deriving of classes? I imagine it would have been harder, but I fail to see if would have been possible... Le 12 mars 2012 16:58, José Pedro Magalhães j...@cs.uu.nl a écrit : Hi Yves, GHC.Generics [1] and SYB [2] are two rather different approaches to generic

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-25 Thread José Pedro Magalhães
2012/2/25 Andres Löh andres.l...@googlemail.com Would you have an example of a type for which it would be useful to have a DeepSeq instance, and that would require a V1 instance? I cannot think of one now; I originaly thought it would be necessary to permit deriving DeepSeq instances for

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread José Pedro Magalhães
2012/2/24 Maxime Henrion mhenr...@gmail.com On Fri, 2012-02-24 at 07:49 +0100, Jos Pedro Magalhes wrote: Hi, 2012/2/23 Maxime Henrion mhenr...@gmail.com * Why do you have the instance: instance GDeepSeq V1 where grnf _ = () The only

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread José Pedro Magalhães
Hi Andres, 2012/2/24 Andres Löh andres.l...@googlemail.com I don't understand what's going on here. Instances for V1 should of course be defined if they can be! And in this case, a V1 instance makes sense and should be defined. The definition itself doesn't matter, as it'll never be

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-23 Thread José Pedro Magalhães
Hi, 2012/2/23 Maxime Henrion mhenr...@gmail.com * Why do you have the instance: instance GDeepSeq V1 where grnf _ = () The only way to construct values of a void type is using ⊥. And I would expect that rnf ⊥ = ⊥, not (). I think the best thing is to just remove the V1 instance.

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-19 Thread José Pedro Magalhães
Hi, 2012/2/19 Bas van Dijk v.dijk@gmail.com I do think it's better to integrate this into the deepseq package (and thus removing the default implementation of rnf). Otherwise we end up with two ways of evaluating values to normal form. I agree with this, and I guess many people are

Re: [Haskell-cafe] GHC 7.4: Expected behavior or bug?

2011-12-27 Thread José Pedro Magalhães
Hi, This is a change in behavior. Previously GHC was more liberal than Haskell 98 prescribed, and would not default the kind of otherwise unconstrained type variables to *. 7.4 does default to *, so you have to provide kind signatures when you want another kind (particularly in phantom type

Re: [Haskell-cafe] Poll: Do you want a mascot?

2011-11-23 Thread José Pedro Magalhães
Yes On Wed, Nov 23, 2011 at 19:11, heathmatlock heathmatl...@gmail.com wrote: Question: Do you want a mascot? Answers: Yes No -- This is an attempt to figure out if this idea is going anywhere. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] A Mascot

2011-11-15 Thread José Pedro Magalhães
In general, I like the idea of having a mascot, and think that something along these lines will be great. Cheers, Pedro On Wed, Nov 16, 2011 at 01:01, heathmatlock heathmatl...@gmail.com wrote: I liked Go's mascot, and I figure it couldn't hurt to have our own. I spent the past hour making

Re: [Haskell-cafe] Usage question with TemplateHaskell and Generic

2011-11-07 Thread José Pedro Magalhães
Hi, I'm not sure I understand your question. But if you mean that you want to retrieve the type variable names, as they were defined in the source, then I can tell you that the generic deriving mechanism cannot do this. Cheers, Pedro On Sun, Nov 6, 2011 at 14:35, Magicloud Magiclouds

Re: [Haskell-cafe] Is generic information dumpable?

2011-11-04 Thread José Pedro Magalhães
(GHC.Generics.Par0 a_adY))) Still not perfect, in that the representation type should really appear as a type instance inside the Generic instance, but at least all the important information is printed. Cheers, Pedro 2011/11/3 Bas van Dijk v.dijk@gmail.com 2011/11/3 José Pedro Magalhães j...@cs.uu.nl

Re: [Haskell-cafe] Is generic information dumpable?

2011-11-04 Thread José Pedro Magalhães
2011/11/4 Bas van Dijk v.dijk@gmail.com Thanks José! Will this make it into ghc-7.4? Yes, I think so. Cheers, Pedro Bas 2011/11/4 José Pedro Magalhães j...@cs.uu.nl: Hi, Now, for the following datatype: data X a = X { myX :: a } deriving Generic You get the following

Re: [Haskell-cafe] ghc 7.2.1 Generics problem

2011-11-03 Thread José Pedro Magalhães
Thanks, you spotted another mistake on that page, I corrected it. Make sure to have a look at the functions in http://hackage.haskell.org/package/generic-deriving too; I'm sure those compile :-) Pedro 2011/11/3 Magicloud Magiclouds magicloud.magiclo...@gmail.com 2011/11/1 José Pedro

Re: [Haskell-cafe] How to speedup generically parsing sum types?

2011-11-03 Thread José Pedro Magalhães
Hi Bas, First of all, thanks for these numbers. I have previously compared the performance of GP libs [1] and your results confirm what I would expect, except for that last one, BigSum/fromJSON/generic. It's good that you're using INLINE pragmas on the generic function already. What I would also

Re: [Haskell-cafe] Is generic information dumpable?

2011-11-03 Thread José Pedro Magalhães
-ddump-deriv will print (most of) it. Cheers, Pedro On Thu, Nov 3, 2011 at 16:26, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, I am learning the new generic feature of ghc. I'd have to say, it is harder than template to enter. When I started to learn template, ghc

Re: [Haskell-cafe] Is generic information dumpable?

2011-11-03 Thread José Pedro Magalhães
Hi, 2011/11/3 Bas van Dijk v.dijk@gmail.com 2011/11/3 José Pedro Magalhães j...@cs.uu.nl: -ddump-deriv will print (most of) it. But it doesn't print the most useful piece of information: the definition of Rep. Yes... I am aware of this. It would be great if this could be added

Re: [Haskell-cafe] ghc 7.2.1 Generics problem

2011-11-01 Thread José Pedro Magalhães
Oh, right, I see that some things on that page need updating; I'll do so. Thanks, Pedro On Tue, Nov 1, 2011 at 09:33, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: On Tue, Nov 1, 2011 at 1:59 PM, Andres Löh andres.l...@googlemail.com wrote: Hi. I do not know why, my ghc

Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread José Pedro Magalhães
On Tue, Nov 1, 2011 at 09:43, Conrad Parker con...@metadecks.org wrote: On 1 November 2011 03:43, Alexander Kjeldaas alexander.kjeld...@gmail.com wrote: On 31 October 2011 17:22, Yitzchak Gale g...@sefer.org wrote: Gregory Crosswhite wrote: could [Hackage] have a feature where when a

Re: [Haskell-cafe] lost in generics

2011-10-20 Thread José Pedro Magalhães
Hi Rusi, GHC has built-in support for two generic programming libraries. SYB [1] support has been there for a long time. The new generic mechanism [2], which allows you to define your own, (almost) derivable classes, only appeared in 7.2, but is planned to stay. What library you should use

Re: [Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread José Pedro Magalhães
Hi Karel, You can use SYB's toConstr/dataTypeOf [1] to obtain information about the name of the constructor and datatype. Alternatively, you can also use the new generic programming framework of ghc-7.2 [2]. Cheers, Pedro [1]

Re: [Haskell-cafe] Generics (SYB) with parametrized types

2011-08-16 Thread José Pedro Magalhães
Hi, I'm not sure I fully understand what you're trying to do, but when I read Ideally, I'd like to restrict my search to Located instances that wrap an instance of Outputable, I think this means SYB is not the right tool. Due to the way Typeable works (it's monomorphic), SYB doesn't really

Re: [Haskell-cafe] Deriving instances with GADTs

2011-08-04 Thread José Pedro Magalhães
describe the issue in more detail in the paper: José Pedro Magalhães and Johan Jeuring. Generic Programming for Indexed Datatypes. Color pdf: http://dreixel.net/research/pdf/gpid.pdf Greyscale pdf: http://dreixel.net/research/pdf/gpid_nocolor.pdf Cheers, Pedro Many thanks in advance, Tim

Re: [Haskell-cafe] I confused myself with generics, and now I confused ghc too

2011-07-19 Thread José Pedro Magalhães
Hi Ari, I won't really try to answer your question, but I'll give you the code for gzipWithQ written by Alexey Rodriguez Yakushev some years ago for his comparison on generic programming libraries. The original darcs repo no longer exists, but here is the file which I think is relevant for you:

[Haskell-cafe] Build failure on Hackage, missing syb

2011-06-16 Thread José Pedro Magalhães
Hi all, What causes the following build failure on Hackage? *** setup configure Configuring instant-generics-0.3.2... cabal-setup: At least the following dependencies are missing: syb 0.4 This is in package

[Haskell-cafe] Local copy of hackageDB

2011-04-07 Thread José Pedro Magalhães
Hi all, I want to use cabal-install on a machine without internet access. I tried downloading http://hackage.haskell.org/cgi-bin/hackage-scripts/archive.tar, unpacking it and setting the local-repo field in the config file to this location but that doesn't work, as cabal-install says that it is

Re: [Haskell-cafe] Local copy of hackageDB

2011-04-07 Thread José Pedro Magalhães
, Pedro 2011/4/7 Yitzchak Gale g...@sefer.org José Pedro Magalhães wrote: I want to use cabal-install on a machine without internet access. Work is ongoing for a version of hackage that you can just install on your own server. Perhaps the people working on that can comment about the status

Re: [Haskell-cafe] Local copy of hackageDB

2011-04-07 Thread José Pedro Magalhães
Yes, I have that tarball. I just don't know how to tell cabal-install to use it. Going to each package, individually unpacking and installing it is what I've been doing so far, but I was hoping that could be automated. Cheers, Pedro On Thu, Apr 7, 2011 at 14:18, Magnus Therning

Re: [Haskell-cafe] Install GTK on Windows

2011-03-16 Thread José Pedro Magalhães
to use a tool like process explorer [1] to see which specific dlls are getting loaded when you run. Ryan [1] http://technet.microsoft.com/en-us/sysinternals/bb896653 2011/3/15 José Pedro Magalhães j...@cs.uu.nl Hi all, I'd just like to add that I succeeded in building gtk2hs in Windows XP

Re: [Haskell-cafe] Install GTK on Windows

2011-03-15 Thread José Pedro Magalhães
Hi all, I'd just like to add that I succeeded in building gtk2hs in Windows XP 64bit with GHC 7.0.2, using the 2.16 bundle from [1] and following the instructions in [2]. However, running the test program of [2] still fails at runtime with The procedure entry point g_assertion_message_expr could

[Haskell-cafe] Some quick experiments with GHC 7.0.2 in Intel's Manycore Testing Lab (32 cores)

2011-03-11 Thread José Pedro Magalhães
Hi all, I've played a bit with Intel's Manycore Testing Lab ( http://software.intel.com/en-us/articles/intel-many-core-testing-lab/). Part of the agreement to use it requires that you report back your experiences, which I did in an Intel forum post (

[Haskell-cafe] SMP parallelism gains inferior than expected

2011-02-24 Thread José Pedro Magalhães
(Forwarding to haskell-cafe) Hi, I have a program that computes a matrix of Floats of m rows by n columns. Computing each Float is relatively expensive. Each line is completely independent of the others, so I thought I'd try some simple SMP parallelism on this code: myFun :: FilePath - IO ()

[Haskell-cafe] ANNOUNCE: htime-0.1

2011-02-24 Thread José Pedro Magalhães
Hello all, I kept being annoyed at the fact that Windows doesn't come with anything similar to the unix time utility, so I created a small Haskell program that does something similar. I thought this could perhaps be useful to others, so it's now available on Hackage:

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

2011-02-15 Thread José Pedro Magalhães
Hello, 2011/2/15 Simon Peyton-Jones simo...@microsoft.com but currently any pragmas in a class decl are treated as attaching to the *default method*, not to the method selector: Thanks for this clarification, I had wondered about this for a while. I think it would also be nice to mention

Re: [Haskell-cafe] SYB: extending a generic reader with a type class

2011-02-02 Thread José Pedro Magalhães
Hi, I don't think you can do that, since `ext` relies on Typeable and Typeable only works for monomorphic types. Cheers, Pedro On Wed, Feb 2, 2011 at 20:31, Sugar Bzzz sugarbz...@gmail.com wrote: Dear -cafe, Is it possible to extend a generic reader (extR / ext1R from syb) with a type

Re: [Haskell-cafe] Compiling UHC

2010-08-23 Thread José Pedro Magalhães
Hi Henk-Jan, On Mon, Aug 23, 2010 at 00:15, Henk-Jan van Tuyl hjgt...@chello.nl wrote: L.S., I am trying to compile the current release of UHC (1.0.1); I started with the installation of the most recent version of uulib and uuagc. When running make uhc I received the following message:

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-23 Thread José Pedro Magalhães
Hi Romildo, 2010/7/23 José Romildo Malaquias j.romi...@gmail.com On Tue, Jul 20, 2010 at 09:17:15AM +0200, José Pedro Magalhães wrote: 2010/7/19 José Romildo Malaquias j.romi...@gmail.com I am writing here to ask suggestions on how to annotate an ast with types (or any other

Re: [Haskell-cafe] Re: Tiger compiler in Haskell: annotating abstract

2010-07-21 Thread José Pedro Magalhães
Hi Oleg, On Wed, Jul 21, 2010 at 09:36, o...@okmij.org wrote: Jose Pedro Magalhaes wrote: From what I understand, you are using a list of integers to encode a path to a subterm. This is a practical and lightweight implementation, but less type-safe: it is easy to encode annotations that

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-20 Thread José Pedro Magalhães
have type annotations, but declarations can not. Comments? Indeed I would suggest the method described in our paper: Martijn van Steenbergen, José Pedro Magalhães, and Johan Jeuring. Generic selections of subexpressions. Paper link: http://dreixel.net/research/pdf/gss_draft.pdf Related hackage

Re: [Haskell-cafe] Re: Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-20 Thread José Pedro Magalhães
Hi Oleg, From what I understand, you are using a list of integers to encode a path to a subterm. This is a practical and lightweight implementation, but less type-safe: it is easy to encode annotations that do not correspond to any value. Also, it cannot guarantee, with types alone, that every

Re: [Haskell-cafe] GADTs and Scrap your Boilerplate

2010-05-16 Thread José Pedro Magalhães
Hi Oscar, On Sat, May 15, 2010 at 22:19, Oscar Finnsson oscar.finns...@gmail.comwrote: (...) I guess my questions are: 1. Is it possible to combine GADTs with Scrap your Boilerplate? Your GADT encodes an existential datatype. The closest attempt to encode existential types in (something

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

2010-04-19 Thread José Pedro Magalhães
Hi Ozgur, At least template-haskell-2.4.0.0 (which comes with GHC 6.12) has syntax for type equality constraints [1], so I'm guessing it should support GADTs (I haven't actually tested it). It also has syntax for type families. Cheers, Pedro [1]

Re: [Haskell-cafe] Re: cabal: other-modules

2010-04-15 Thread José Pedro Magalhães
Hi, On Thu, Apr 15, 2010 at 14:40, Johannes Waldmann waldm...@imn.htwk-leipzig.de wrote: What happened was this: 1. add some modules to a library (but forget to mention them in the cabal file), then (in the lib source dir, without cleaning/reconfiguring) cabal install --global (runs

Re: [Haskell-cafe] SYB/Generics documentation inaccessible

2010-02-02 Thread José Pedro Magalhães
A few days ago I changed the links from the SYB wiki [1] to point to an archived version of the vu.nl webpage: http://web.archive.org/web/20080622204226/http://www.cs.vu.nl/boilerplate/ But it would be nice to have the webpage up again, somewhere. Cheers, Pedro [1]

Re: [Haskell-cafe] Re: could we get a Data instance for Data.Text.Text?

2010-01-25 Thread José Pedro Magalhães
Hi Jeremy, As Neil Mitchell said before, if you really don't want to expose the internals of Text (by just using a derived instance) then you have no other alternative than to use String conversion. If you've been using it already and performance is not a big problem, then I guess it's ok.

Re: [Haskell-cafe] Largest types in SYB

2009-12-21 Thread José Pedro Magalhães
Hello Paul, On Fri, Dec 18, 2009 at 16:47, Paul Keir pk...@dcs.gla.ac.uk wrote: (...) I'm enjoying using SYB, and had hoped to use only functions from the package, but couldn't find a way; and this does the job for now. I've also seen that there are many other approaches to generic

Re: [Haskell-cafe] ANNOUNCE: deepseq-1.0.0.0

2009-11-17 Thread José Pedro Magalhães
Hello, The release of the regular library for generic programming on Hackage [1] also contains a form of deep seq [2]. This means that you don't even have to write the definition of 'deepseq', you can just use 'gdseq' (assuming you have used Template Haskell to derive the generic representations

Re: [Haskell-cafe] Documentation (was: ANN: text 0.5, a major revision of the Unicode text library)

2009-10-19 Thread José Pedro Magalhães
Hi, While I agree that the documentation of Data.Generics is not perfect, I do not think it is possible to have the haddock documentation be self-contained. For a thorough understanding of syb, a user has to read the two initial papers, which are linked from the haddock documentation. I also do

Re: Re[2]: [Haskell-cafe] Any generic serializer to String? was: Any working example of using genericserialize?

2009-10-01 Thread José Pedro Magalhães
Hi Dimitry, On Thu, Oct 1, 2009 at 05:23, Dimitry Golubovsky golubov...@gmail.comwrote: OK, I got it to work with gread/gshow. However I have noticed this: *Main (gread $ gshow $ FuncExpr 0 [] (EmptyStmt 0)) :: [(Expression Int, String)] [(FuncExpr 0 [] (EmptyStmt 0),)] vs. *Main

Re: [Haskell-cafe] Ambiguous type variable with subclass instance (also: is there a better way to do this?)

2009-09-17 Thread José Pedro Magalhães
Hey Andy, On Thu, Sep 17, 2009 at 15:40, Andy Gimblett hask...@gimbo.org.uk wrote: Now, some of those algebraic data type types happen to be enumerations; in this case, my idea is to list the constructors, with the rule that each constructor's position in the list is the Int which gets

Re: [Haskell-cafe] Ambiguous type variable with subclass instance (also: is there a better way to do this?)

2009-09-17 Thread José Pedro Magalhães
Hello, On Thu, Sep 17, 2009 at 16:05, Daniel Fischer daniel.is.fisc...@web.dewrote: Am Donnerstag 17 September 2009 15:56:03 schrieb José Pedro Magalhães: Hey Andy, On Thu, Sep 17, 2009 at 15:40, Andy Gimblett hask...@gimbo.org.uk wrote: Now, some of those algebraic data type types

Re: [Haskell-cafe] Externally derive instance of Data?

2009-09-11 Thread José Pedro Magalhães
Hi Dimitry, I think what you want is stand-alone deriving: http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html#stand-alone-deriving Cheers, Pedro On Fri, Sep 11, 2009 at 16:29, Dimitry Golubovsky golubov...@gmail.comwrote: Hi, Given a datatype defined somewhere in a

Re: [Haskell-cafe] Deconstructing types

2009-09-09 Thread José Pedro Magalhães
Hello Louis, On Tue, Sep 8, 2009 at 19:06, Louis Wasserman wasserman.lo...@gmail.comwrote: Sean, The answer is, I'm working on a recently semi-released package called TrieMap. Is that similar to what is done in [1]? A draft paper [2] also refers that implementation. Cheers, Pedro [1]

Re: [Haskell-cafe] Generics for constructing Rows

2009-08-21 Thread José Pedro Magalhães
Hello, On Thu, Aug 20, 2009 at 16:54, Max Desyatov explicitc...@googlemail.comwrote: Sean Leather leat...@cs.uu.nl writes: I'm not sure the problem you're running into is strictly a generic programming (GP) one. Typically, GP takes code that is often written and generalizes it, so that

Re: [Haskell-cafe] Adding a field to a data record

2009-07-29 Thread José Pedro Magalhães
Hello Henry, The paper A Lightweight Approach To Datatype-Generic Rewriting [1] describes a way to generically add a constructor to any regular datatype using type-indexed datatypes [2]. A similar technique could be used to add a new field to each constructor. Then you get something like: data

Re: [Haskell-cafe] Can you determine a constructor's arity using Data.Typeable and Data.Data?

2009-06-25 Thread José Pedro Magalhães
Hey David, For instance: arity :: (Data a) = a - Int arity = length . gmapQ (const ()) Cheers, Pedro On Thu, Jun 25, 2009 at 17:31, David Fox dds...@gmail.com wrote: Is it possible to determine the arity of a value's constructor? Suppose I have a value x of type data A = B Int | C

Re: [Haskell-cafe] understanding generics

2009-04-16 Thread José Pedro Magalhães
Hello Anatoly, On Sat, Apr 11, 2009 at 20:44, Anatoly Yakovenko aeyakove...@gmail.comwrote: i am trying to understand how data.data works. How would i traverse the subterms of one type and build another type out of them. something like this: gmapQ (\a - Right a) (Just hello) I am not

Re: [Haskell-cafe] type-level programming support library

2009-03-30 Thread José Pedro Magalhães
Hello, I suppose Lennart is referring to type-level [1]. But type-level uses functional dependencies, right? There is also tfp [2], which uses type families. In general, how would you say your work compares to these two? Thanks, Pedro [1]

Re: [Haskell-cafe] Re: is there any reason why Language.C.Syntax.AST.CTranslUnit doesn't derive show?

2009-03-28 Thread José Pedro Magalhães
Hello Anatoly, Bear in mind that gshow behaves a bit differently from the regular show (namely regarding parenthesis and efficiency). You can also use standalone deriving [1] to derive Show for those datatypes. Cheers, Pedro [1]

Re: [Haskell-cafe] Confused by SYB example with zipping

2009-02-16 Thread José Pedro Magalhães
Hello Henry, Changes to GHC regarding the treatment of higher-rank types required a few changes to that test too. You have to eta-expand the application of mkTT and give it a type signature. Therefore, main becomes print $ gzip (\x y - mkTT maxS x y) genCom1 genCom2 and you have to add the

Re: [Haskell-cafe] simple generic / data view library?

2008-11-17 Thread José Pedro Magalhães
Hello Conal, What you've done looks very much like the Regular datatype [1] in the rewriting library [2]. The rewriting library, as its name indicates, is very much targeted at rewriting. For a more complete library using a sum of products view (and without type synonyms), try the new release of

Re: [Haskell-cafe] Proposal for associated type synonyms in Template Haskell

2008-11-11 Thread José Pedro Magalhães
Hello Thomas, I see this is a proposal for a partial implementation of #1673 ( http://hackage.haskell.org/trac/ghc/ticket/1673). Maybe it would be good if the remaining syntax (associated datatypes and type families) would also be defined and implemented in TH. Or maybe there isn't much demand

Re: [Haskell-cafe] Hackage Improvement Ideas

2008-10-23 Thread José Pedro Magalhães
I think at least some sort of statistics of visits and downloads of a package would be very useful, also for the developers to have an idea of how many people are using the package. Pedro On Thu, Oct 23, 2008 at 13:12, Jason Dagit [EMAIL PROTECTED] wrote: Hello, I was thinking of fun little

Re: [Haskell-cafe] ANN: Haskore tutorial (programming music using Haskell)

2008-08-06 Thread José Pedro Magalhães
Hi Jinjing, I remember having written a report on Haskore some years ago, together with a classmate. I think that the example of transformations in twelve-tone technique (see [1]) is one that looks very nice in Haskore due to its simplicity. It's also simple to present to people who do not know