Re: [Haskell-cafe] Applicative combinators from Parsec

2009-03-13 Thread andy morris
2009/3/13 Martijn van Steenbergen : > 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 x y))

Re: [Haskell-cafe] Vim support for cabal

2009-03-13 Thread andy morris
2009/3/13 Pavel Perikov : > 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, so you inspi

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

2009-04-02 Thread andy morris
2009/4/2 Henry Laxen : > 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 pointing at: > nor

Re: [Haskell-cafe] Generating functions for games

2009-04-03 Thread andy morris
2009/4/4 : > 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 plastic > sh

Re: [Haskell-cafe] Using Data.Complex

2009-04-22 Thread andy morris
2009/4/22 michael rice : > 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 package base .

Re: [Haskell-cafe] Deriving type family data

2009-04-28 Thread andy morris
2009/4/28 Tuve Nordius : > 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 >        deriving (Data

Re: [Haskell-cafe] fromInteger for Lists

2009-05-01 Thread andy morris
2009/5/1 Paul Keir : > 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 19::(Foo

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 : > I've often thought having constructor "views" w

Re: [Haskell-cafe] About the import module

2009-08-05 Thread andy morris
2009/8/5 xu zhang : > 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 export? > Because

Re: [Haskell-cafe] Debugging Haskell code

2009-09-27 Thread andy morris
2009/9/27 Paul Moore : > 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 (which I didn't > u

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

2009-10-08 Thread andy morris
2009/10/8 Andrew U. Frank : > 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 declaration. > (i have imp

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 -> Fa