Re: [Haskell-cafe] Type question re: map

2009-03-06 Thread sam lee
map :: (a -> b) -> [a] -> [b] map takes a function and transforms a list of a's to b's. map succ [1,2,3] ==> [succ 1, succ 2, succ 3] ==> [2, 3, 4] In general, map f :: [a] -> [b] where a is domain-type of f and b is image-type of f (f :: a -> b). map map [x, y, z] ==> [map x, map y, map z] so

Re: [Haskell-cafe] C-like Haskell

2009-01-28 Thread sam lee
Did you print it? I'm using same code with ghc --make -O2 and it takes forever to finish. On Wed, Jan 28, 2009 at 8:06 PM, Duncan Coutts wrote: > On Wed, 2009-01-28 at 16:42 -0800, drblanco wrote: > >> I do already have the number I wanted, but was wondering how this could be >> made faster, or

Re: [Haskell-cafe] Stupid question, re: overloaded type classes

2009-01-18 Thread sam lee
The following code compiles fine on my ghci ghci> :l sexpr.hs [1 of 1] Compiling Sexpr( sexpr.hs, interpreted ) Ok, modules loaded: Sexpr. $ ghci --version The Glorious Glasgow Haskell Compilation System, version 6.8.2 -- code {-# LANGUAGE TypeSynonymInstances #-} module Sexp

Re: [Haskell-cafe] Simplification of this function?

2009-01-16 Thread sam lee
Sorry it won't work because list should be homogeneous. I think your myFunc is standard. This guy names it "thread": http://alaska-kamtchatka.blogspot.com/2009/01/essence-of-concatenative-languages.html On Fri, Jan 16, 2009 at 10:32 AM, sam lee wrote: > @pl myFunc f (a,b) (c,

Re: [Haskell-cafe] Simplification of this function?

2009-01-16 Thread sam lee
@pl myFunc f (a,b) (c,d) = (f a c, f b d) myFunc = (`ap` snd) . (. fst) . flip flip snd . ((flip . (ap .)) .) . flip flip fst . ((flip . ((.) .)) .) . (flip =<< (((.) . flip . (((.) . (,)) .)) .)) why not use zipWith? [a,b] `g` [c,d] where g = zipWith f 2009/1/16 Andrew Wagner > I've been p

Re: [Haskell-cafe] Time for a new logo?

2008-12-14 Thread sam lee
http://i35.tinypic.com/mjon83.png used this: http://www.simwebsol.com/ImageTool/Default.aspx 2008/12/14 George Pollard : > ? > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > _

Re: [Haskell-cafe] Parsec and (then?) type-check

2008-12-12 Thread sam lee
I use my type checking monad, which is separate from Parsec's monad. So, I can't think of a way to type check during parsing in Parsec's monad. Anyways, this is what I did: data Expr = ... | At SourcePos Expr SourcePos is from Parsec. Basically, my parse actions will return (At pos e). And I p

Re: [Haskell-cafe] SDL program under MinGW

2008-12-07 Thread sam lee
On Sun, Dec 7, 2008 at 4:23 AM, Bit Connor <[EMAIL PROTECTED]> wrote: > Did you follow the instructions described in the WIN32 file? > > On Sat, Dec 6, 2008 at 2:05 PM, sam lee <[EMAIL PROTECTED]> wrote: >> Hi. >> >> I am using Windows Vista. >> I insta

Re: [Haskell-cafe] SDL program under MinGW

2008-12-06 Thread sam lee
instead do the > initialization itself; see the rest of that FAQ question. > > In fact, the "MACOSX" readme file in the Haskell SDL binding talks > about exactly this problem. > > -- ryan > > On Sat, Dec 6, 2008 at 2:05 PM, sam lee <[EMAIL PROTECTED]> wrote: >

[Haskell-cafe] SDL program under MinGW

2008-12-06 Thread sam lee
Hi. I am using Windows Vista. I installed the following: - ghc 6.8.3 (using official Windows binary installer) - MinGW (from http://nuwen.net/mingw.html) - SDL binding (from http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SDL) I am trying to compile the following program: module

Re: [Haskell-cafe] bug in time libs?

2008-12-01 Thread sam lee
I can't find document for System.Time . But I can import System.Time . It's weird... I can't find document for TimeDiff and related functions. I guess this is all deprecated. A related bug report: http://hackage.haskell.org/trac/ghc/ticket/2519 I would use Data.Time.Clock Prelude> :m + Data.Tim

Re: [Haskell-cafe] '#' in literate haskell

2008-11-29 Thread sam lee
# is significant because it can be sh-bang line or pre-processor. The only way I can think of is: alias lhspp="sed 's/^#//'" ghc --make -F -pgmF lhspp File.lhs On Sat, Nov 29, 2008 at 10:07 PM, John MacFarlane <[EMAIL PROTECTED]> wrote: > Can anyone explain why ghc does not treat the following

Re: [Haskell-cafe] SOEGraphics in GHC?

2008-11-24 Thread sam lee
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HGL or http://hackage.haskell.org/cgi-bin/hackage-scripts/package/soegtk 2008/11/24 Dmitri O.Kondratiev <[EMAIL PROTECTED]>: > Please help, to locate in GHC distribution SOEGraphics library from > Paul Hudak, book "The Haskell School of E

Re: [Haskell-cafe] What *not* to use Haskell for

2008-11-11 Thread sam lee
I haven't found multitrack audio recording applications written in Haskell. These are usually written in C++ using Jack audio or ASIO. This probably means that it is not a good idea to write real time audio applications in Haskell at the moment. So, probably avoid writing applications that use a hi

Re: [Haskell-cafe] An interesting curiosity

2008-09-18 Thread sam lee
I think it's because + is left associative. and pattern matching is top to bottom. 1 + 1 + 1 => (1 + 1) + 1 => found match: 1 + 1 = 3 => 3 + 1 => found match: 3 + 1 = 3 => 3 On Thu, Sep 18, 2008 at 11:01 PM, Steven Shaw <[EMAIL PROTECTED]> wrote: > 2008/9/19 Evan Laforge <[EMAIL PROTECTED]> >> let

Re: [Haskell-cafe] How to do this in FP way?

2008-06-15 Thread sam lee
I can think of 2 ways. > module Main where > > import Control.Monad.State First, normal way: > diff (now, old) = (now - old, now) diff takes now and old and returns result (now - old) and modified old (now). For example, diff (diff (1,0)) ==> diff (1 - 0, 1) ==> diff (1, 1) ==>

Re: [Haskell-cafe] M1 + M2 = M3 where both computations in M1 and M2 can be used?

2008-05-12 Thread sam lee
> tInfer :: MonadTypeInfer m => Expr -> m Type > eval :: MonadEval m => Expr -> m Expr That solves! I should've left out type annotation. On Mon, May 12, 2008 at 10:38 AM, Twan van Laarhoven <[EMAIL PROTECTED]> wrote: > sam lee wrote: > > >

[Haskell-cafe] M1 + M2 = M3 where both computations in M1 and M2 can be used?

2008-05-12 Thread sam lee
Hi. I want to compose two monads to build another monad where computations of the two monads can be used inside. I have: - MonadTypeInfer : interface (class) for TypeInfer monad - TypeInfer : a monad that has Map String Type (association of names and types) - TypeInferT : transformer of above mo