[Haskell-cafe] Type constructor variables no longer injective in GHC 7.2.1?

2011-10-21 Thread Daniel Schüssler
Hello Cafe, say we take these standard definitions: > {-# LANGUAGE GADTs, TypeOperators, TypeFamilies, ScopedTypeVariables #-} > data a :=: b where > Refl :: a :=: a > subst :: a :=: b -> f a -> f b > subst Refl = id Then this doesn't work (error message at the bottom): > inj1 :: forall

Re: [Haskell-cafe] Deriving instances with GADTs

2011-08-05 Thread Daniel Schüssler
iving' clause; the former generates the code regardless of how weird the type is and lets the typechecker decide. For your GADT, this succeeds). Cheers, Daniel Schüssler On 2011-August-04 Thursday 08:57:46 Tim Cowlishaw wrote: > Hi all, > > I've been writing a DSL to describe securit

Re: [Haskell-cafe] Data.Time

2011-06-27 Thread Daniel Schüssler
On 2011-June-27 Monday 10:15:28 Yitzchak Gale wrote: > The biggest shortcoming, in my opinion, is that the documentation > assumes that the reader is very familiar with the Haskell type > system, and with viewing type signatures and instance lists as an > integral and central part of the documentat

Re: [Haskell-cafe] Type Constraints on Data Constructors

2011-06-09 Thread Daniel Schüssler
ut. > > > > - Original Message - > > > From: Daniel Schüssler > > To: haskell-cafe@haskell.org > > Cc: Guy > > Sent: Thursday, 9 June 2011, 2:06 > > Subject: Re: [Haskell-cafe] Type Constraints on Data Constructors > >

Re: [Haskell-cafe] Type Constraints on Data Constructors

2011-06-09 Thread Daniel Schüssler
Correction: I meant data Baz f a = Baz (Foo f => f a) (Dropped the 'forall', which would make the inner 'f' have nothing to do with the type parameter 'f' of 'Baz') On 2011-June-09 Thursday 01:07:13 Daniel Schüssler wrote: > Hello, > > y

Re: [Haskell-cafe] Type Constraints on Data Constructors

2011-06-08 Thread Daniel Schüssler
Hello, you might be thinking of this type? {-# LANGUAGE Rank2Types #-} class Foo f where foo :: a -> f a data Baz f a = Baz (forall f. Foo f => f a) instance Foo (Baz f) where foo a = Baz (foo a) Maybe the difference between Bar and Baz ist best explained by writing it with an expl

[Haskell-cafe] Question about the Monad instance for Iteratee (from the enumerator package)

2011-04-19 Thread Daniel Schüssler
Hello, for reference, said instance is: > instance Monad m => Monad (Iteratee a m) where > return x = yield x (Chunks []) > > m0 >>= f = ($ m0) $ fix $ > \bind m -> Iteratee $ runIteratee m >>= \r1 -> > case r1 of > Co

Re: [Haskell-cafe] Template Haskell question

2011-04-17 Thread Daniel Schüssler
Hello, assuming you mean avoiding the import of Data.Map in the module *using* x, you can use name quotations: A.hs: > {-# LANGUAGE TemplateHaskell #-} > > module A where > > import Data.Map > import Language.Haskell.TH > > x = varE 'empty > B.hs: > {-# LANGUAGE TemplateHaskell #-} > m

[Haskell-cafe] Computing the multiplication table of a group using the GHC inliner ; )

2011-03-22 Thread Daniel Schüssler
Hello, turns out that you can define the group operation of the symmetric group on 3 elements in this abstract way (via the isomorphism to the group of bijective functions from a three-element type to itself): s3mult g2 g1 = fromFun (toFun g2 . toFun g1) and convince GHC to compile it

Re: [Haskell-cafe] segfault when using ghc api

2011-02-28 Thread Daniel Schüssler
Hi, On 2011-February-27 Sunday 16:20:06 Edward Amsden wrote: > Secondly, > > I'd like to get to a GHC session that just has, say, Prelude in scope > so I can use dynCompileExpr with "show" etc, but I cannot figure out > how to bring it into scope. The closest I got was to get GHC > complaining th

Re: [Haskell-cafe] Linear programming in Haskell

2010-02-25 Thread Daniel Schüssler
On Thursday 18 February 2010 11:26:02 Ozgur Akgun wrote: > I've no idea about the GLPK system. > > But, isn't it the case that you can transform any linear inequality into a > linear equality and a slack (or excess) variable? Well yes, but the slack variables are constrained to be nonnegative, wh

Re: [Haskell-cafe] Linear programming in Haskell

2010-02-24 Thread Daniel Schüssler
Hello Alberto, Thank you! I don't have a problem calling for LP at hand right now, but some time ago I was looking for such a package. Now I know where to look next time :) Greetings, Daniel On Wednesday 24 February 2010 11:07:08 Alberto Ruiz wrote: > I have uploaded to hackage an interface

Re: [Haskell-cafe] What is the meaning of tilde ("~") symbol

2010-02-17 Thread Daniel Schüssler
On Sunday 14 February 2010 17:02:36 Henk-Jan van Tuyl wrote: > The symbols that are not specified in a library can be found here: >http://www.haskell.org/haskellwiki/Keywords > Hoogle used to show links to this page, when a keyword was searched, but > not anymore. > This isn't Haskell 98 only

[Haskell-cafe] Typeclasses for name punning (was: Re: I miss OO)

2009-11-27 Thread Daniel Schüssler
Hi all, On Wednesday 25 November 2009 22:46:42 Luke Palmer wrote: > I feel like this should be qualified. Type classes are not for name > punning ; you wouldn't use a type class for the method bark on types > Tree and Dog. But if you have a well-defined *structure* that many > types follow, then

Re: [Haskell-cafe] Could someone teach me why we use Data.Monoid?

2009-11-15 Thread Daniel Schüssler
On Sunday 15 November 2009 13:05:08 Nicolas Pouillard wrote: > Excerpts from Daniel Schüssler's message of Sun Nov 15 07:51:35 +0100 2009: > > Hi, > > Hi, Hi, > > > -- Invariant 1: There are never two adjacent Lefts or two adjacent Rights > > [...] > > > normalize (Left a0 : Left a1 : as) = L

Re: [Haskell-cafe] Could someone teach me why we use Data.Monoid?

2009-11-14 Thread Daniel Schüssler
Hi, > - Product (a,b) and co-product (Either) of monoids the coproduct of monoids is actually a bit tricky. It could be implemented like this: -- | -- Invariant 1: There are never two adjacent Lefts or two adjacent Rights -- Invariant 2: No elements (Left mempty) or (Right mempty) allowed new

Re: [Haskell-cafe] haskell-src-exts Question

2009-11-14 Thread Daniel Schüssler
Hi, On Friday 13 November 2009 21:08:42 Neil Mitchell wrote: > In HLint I have a bracketing module, which has served me well. Please > take any ideas you need from it - > http://community.haskell.org/~ndm/darcs/hlint/src/HSE/Bracket.hs . In > particular, given a fully bracketed expression, I can c

Re: [Haskell-cafe] Emacs: Haskell snippets for YASnippet

2009-11-04 Thread Daniel Schüssler
Hi Deniz, > Cool stuff, I will probably be using this! thanks :) > > In my opinion, the naming convention is a bit inconsistent. Extension > snippets all begin with "-x" but imports begin with "imp". I'd prefer > seeing import snippets begin with "-i" and use names easier to > remember, e.g. ins

[Haskell-cafe] Emacs: Haskell snippets for YASnippet

2009-11-04 Thread Daniel Schüssler
Hi List, this is rather trivial, but maybe someone else finds these useful: darcs get http://code.haskell.org/~daniels/haskell-snippets/ Especially the LANGUAGE ones have saved me quite some typing :) Additions welcome. Usage: If not already installed, get YASnippet: http://code.google.com/p/

Re: [Haskell-cafe] What's this pattern called?

2009-10-22 Thread Daniel Schüssler
Hi, On Thursday 22 October 2009 09:47:32 Martijn van Steenbergen wrote: > Bonjour café, > > > data ExprF r > > = Add r r > > > > | Sub r r > > | Mul r r > > | Div r r > > | Num Int > > This is a well-known pattern that for example allows nice notation of > morphisms. But

Re: [Haskell-cafe] MTL vs Transformers?

2009-10-13 Thread Daniel Schüssler
On Tuesday 13 October 2009 02:46:29 Erik de Castro Lopo wrote: > Hi all, > > I've just received the following error message: > > headers.hs:6:7: > Could not find module `Control.Monad.Identity': > it was found in multiple packages: transformers-0.1.4.0 mtl-1.1.0.2 > > I'm trying to u

Re: [Haskell-cafe] rewrite rules

2009-06-22 Thread Daniel Schüssler
Hi Sjoerd, I don't know the cause of the problem, but if I add this rule, it works: {-# RULES "inline_map" forall g x. map g x = transform (. g) x -#} maybe, for whatever reason, the 'map' is inlined "too late" for the transform/transform rule to see it? Greetings, Daniel On Monday 22 Ju

Re: [Haskell-cafe] how to #include files within parsec ... without unsafePerformIO?

2009-06-18 Thread Daniel Schüssler
Hi, ParsecT with m=IO? Your 'do' block would become: do i <- getInput included <- liftIO readI -- import Control.Monad.Trans for liftIO setInput included a <- my_str setInput i b <- my_str return $ a ++ " //\n\n " ++ b where readI

Re: [Haskell-cafe] fast Eucl. dist. - Haskell vs C

2009-05-19 Thread Daniel Schüssler
Hi, meh, I just realised that there is no sensible way to actually introduce/eliminate the generated types. I'm attaching a revised version with fromList/toList functions. Maybe the vector type should be polymorphic and be an instance of Functor, Monad and Foldable? But then we really depend on

Re: [Haskell-cafe] fast Eucl. dist. - Haskell vs C

2009-05-19 Thread Daniel Schüssler
Hello! On Monday 18 May 2009 14:37:51 Kenneth Hoste wrote: > I'm mostly interested in the range 10D to 100D is the dimension known at compile-time? Then you could consider Template Haskell. I wrote up some code for generating the vector types and vector subtraction/inner product below, HTH. One

Re: [Haskell-cafe] Classes: functional dependency (type -> value)

2009-05-12 Thread Daniel Schüssler
Hello! The problem is that it's impossible to infer the SomeClass instance from the type SomeRole. If you do "print role", which instance should it use? I can think of two ways around it: -- 1. (dummy parameter) -- data SomeRole a = Role1 | Role2 | Role3 deriving Sho

Re: [Haskell-cafe] Re: Haskell Logo Voting has started!

2009-03-17 Thread Daniel Schüssler
On Tuesday 17 March 2009 21:03:21 Rick R wrote: > QED Hmm? Maybe if confusingness was to be demonstrated, but not bugginess. Both possibilities will result in the same total preordering (defined by (x `betterThanOrEq` y) iff (numberInCombobox x <= numberInCombobox y)), and (AFAIK) only this ord

Re: [Haskell-cafe] Re: Haskell Logo Voting has started!

2009-03-17 Thread Daniel Schüssler
(correction of the example) (105: ) (106: A) (107: X,B) (108: C,D) (109: E ) (110: ) moving down X will result in either (105: A) (106: B) (107: X ) (108: C,D) (109: E ) (110: ) or equivalently (105: ) (106: A) (107: B ) (108: X ) (109: C,D) (110: E) __

Re: [Haskell-cafe] Re: Haskell Logo Voting has started!

2009-03-17 Thread Daniel Schüssler
Hi, > Even worse, the buttons for moving items up and down are buggy - at > least on my browser (Firefox 3.1 beta 2 on Linux). They sometimes > reorder my other votes! Even assuming that the list box code is not > buggy (which I now doubt), not being able to use the buttons makes this > form almos

Re: [Haskell-cafe] Parsing floating point numbers

2009-03-09 Thread Daniel Schüssler
> Although maybeRead was proposed, I cannot find it: here's a replacement... http://hackage.haskell.org/packages/archive/safe/0.2/doc/html/Safe.html#v%3AreadMay Greetings, Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskel

Re: [Haskell-cafe] Basic problem in Haskell language design?

2009-03-02 Thread Daniel Schüssler
Hi, On Sunday 01 March 2009 14:26:42 Nicu Ionita wrote: > [...] > movesFromWord8s (f:t:ws) = (f, t) : movesFromWord8s ws > moverFromWord8s _ = [] > [...] > Are there possible solutions or workarounds? for the particular problem of having to repeat the function name, you could use "case": movesF

Re: [Haskell-cafe] ANN: convertible (first release)

2009-02-10 Thread Daniel Schüssler
, or anything else I tried with "#" on the end of > names, to compile with ghci. In the example below, I get a parse error > at the line defining d2f. Is this a real code snippet? > > > Cheers, > Dylan > > On Feb 10, 2009, at 2:46 AM, Daniel Schüssler wrote: > &g

Re: [Haskell-cafe] ANN: convertible (first release)

2009-02-09 Thread Daniel Schüssler
Hi, On Wednesday 28 January 2009 04:30:07 John Goerzen wrote: > On Tue, Jan 27, 2009 at 09:41:30PM -0500, wren ng thornton wrote: > > I once again point out that realToFrac is *wrong* for converting from > > Float or Double. > > > > > realToFrac (1/0::Float) ::Double > > > > 3.40282366920