Re: [Haskell-cafe] existentially quantified data types - restrictions

2010-03-25 Thread andy morris
Can you have Typeable as an extra constraint? If so: {-# LANGUAGE ExistentialQuantification #-} import Data.Typeable data Baz = forall a. (Eq a, Typeable a) = Baz a instance Eq Baz where Baz x == Baz y = case cast y of Just y' - x == y' Nothing - False ghci Baz

Re: [Haskell-cafe] difference cabal configure and runghc Setup.lhs configure

2009-10-08 Thread andy morris
2009/10/8 Andrew U. Frank fr...@geoinfo.tuwien.ac.at: i have a strange error, which does not occur when i run runghc Setup.lhs configure but when i use cabal configure and then build, it occurs. the error is Type constructor Control.Exception.Exception used as a class in the instance

Re: [Haskell-cafe] Debugging Haskell code

2009-09-27 Thread andy morris
2009/9/27 Paul Moore p.f.mo...@gmail.com: I'm still playing round with my random dieroll generation program. In doing so, I just hit a segmentation fault (I didn't think Haskell could *cause* a segfault!) I'm sure it's my code - I got this to compile by fiddling with types until the errors

Re: [Haskell-cafe] About the import module

2009-08-05 Thread andy morris
2009/8/5 xu zhang douy...@gmail.com: Hi there, If I import a module and do not explicitly point out the entities I have imported. And I want the ghc to point out the entities automatically. Is there any method to do this? any methods to have the ghc point out the entities I import and

Re: [Haskell-cafe] fromInteger for Lists

2009-05-01 Thread andy morris
2009/5/1 Paul Keir pk...@dcs.gla.ac.uk: There's nothing better than making a data type an instance of Num. In particular, fromInteger is a joy. But how about lists? For example, if I have data Foo a = F [a] I can create a fromInteger such as fromInteger i = F [fromInteger i] and then a

Re: [Haskell-cafe] Deriving type family data

2009-04-28 Thread andy morris
2009/4/28 Tuve Nordius t...@student.chalmers.se: If I for some data type wants to derive, in this case Data and Typeable for use with syb code, but the problem is the same regardless what I want to derive. data family Something data Tree = Leaf Something | Fork Something Tree Tree        

Re: [Haskell-cafe] Using Data.Complex

2009-04-22 Thread andy morris
2009/4/22 michael rice nowg...@yahoo.com: Just exploring. How to load? Michael [mich...@localhost ~]$ ghci Data.Complex GHCi, version 6.10.1: http://www.haskell.org/ghc/  :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading

Re: [Haskell-cafe] Generating functions for games

2009-04-03 Thread andy morris
2009/4/4 gwe...@gmail.com: So some time ago I saw mentioned the game of Zendo https://secure.wikimedia.org/wikipedia/en/wiki/Zendo_(game) as a good game for programmers to play (and not just by Okasaki). The basic idea of Zendo is that another player is creating arrangements of little colored

Re: [Haskell-cafe] Problem with prepose.lhs and ghc6.10.1

2009-04-02 Thread andy morris
2009/4/2 Henry Laxen nadine.and.he...@pobox.com: Dear Group, I'm trying to read the paper: Functional Pearl: Implicit Configurations at http://www.cs.rutgers.edu/~ccshan/prepose/ and when running the code in prepose.lhs I get: ../haskell/prepose.lhs:707:0: Parse error in pattern which is

Re: [Haskell-cafe] Applicative combinators from Parsec

2009-03-13 Thread andy morris
2009/3/13 Martijn van Steenbergen mart...@van.steenbergen.nl: Hello, Looking at Parsec 3 I see: chainr1 :: (Stream s m t) = ParsecT s u m a -           ParsecT s u m (a - a - a) - ParsecT s u m a chainr1 p op = scan where  scan = do x - p; rest x  rest x = (do f - op; y - scan; return (f

Re: [Haskell-cafe] Vim support for cabal

2009-03-13 Thread andy morris
2009/3/13 Pavel Perikov peri...@gmail.com: Hi café ! I googled for some kind of vim support for  cabal but found nothing. I mean syntax highlighting of .cabal and probably integration with haskellmode. Did anyone hear about such thing? Pavel I've been wanting something like this as well,

Re: [Haskell-cafe] F# active patterns versus GHC's view

2009-01-15 Thread andy morris
If you don't mind using GHC extensions (which in a view pattern thread probably isn't much of a stretch to assume :) ), there's always record punning (-XNamedFieldPuns): data Foo = { [snip] } f (Foo { a, g }) = ... 2009/1/15 John Van Enk vane...@gmail.com: I've often thought having