[Haskell-cafe] Bulding a library for C users on OS X

2009-10-31 Thread Chris Eidhof
Hey all, I'm trying to call a Haskell function from C, on OS X. There's an excellent post [1] by Tomáš Janoušek that explains how to do this on Linux. However, on OS X, it's different. First of all, it looks like the -no-hs-main flag is ignored, because I get the following error: ghc

[Haskell-cafe] Re: Applicative but not Monad

2009-10-31 Thread Heinrich Apfelmus
Dan Weston wrote: Can you elaborate on why Const is not a monad? return x = Const x fmap f (Const x) = Const (f x) join (Const (Const x)) = Const x This is not Const , this is the Identity monad. The real Const looks like this: newtype Const b a = Const b instance Monoid b =

[Haskell-cafe] Using HaskellDB on Tables that contain same column names

2009-10-31 Thread R . Emre Başar
Hi all, I'm trying to create a HaskellDB application for keeping the inventory of a set of devices. My database includes some tables which have some columns with same names. Here is an example: Server: id, name, vendor (fk), model(fk), system_id (always null) Vendor: id, name Model: id, name

Re: [Haskell-cafe] Applicative but not Monad

2009-10-31 Thread Conor McBride
Hi On 30 Oct 2009, at 16:14, Yusaku Hashimoto wrote: Hello cafe, Do you know any data-type which is Applicative but not Monad? [can resist anything but temptation] I have an example, perhaps not a datatype: tomorrow-you-will-know Cheers Conor

Re: [Haskell-cafe] Re: Applicative but not Monad

2009-10-31 Thread Tom Davie
On 10/31/09, Heinrich Apfelmus apfel...@quantentunnel.de wrote: The only possible monad instance would be return x = Const mempty fmap f (Const b) = Const b join (Const b) = Const b Your join doesn't seem to have the right type... Unless I'm missing something. Bob

Re: [Haskell-cafe] Re: Applicative but not Monad

2009-10-31 Thread Daniel Fischer
Am Samstag 31 Oktober 2009 12:25:17 schrieb Tom Davie: On 10/31/09, Heinrich Apfelmus apfel...@quantentunnel.de wrote: The only possible monad instance would be return x = Const mempty fmap f (Const b) = Const b join (Const b) = Const b Your join doesn't seem to have the

Re: [Haskell-cafe] How to fulfill the code-reuse destiny of OOP?

2009-10-31 Thread Magicloud Magiclouds
Somehow, I agree with you. I think inherit is not evil, the people use it wrong is. The problem here is, inherit is naked right now. So people could use it wrong. On Fri, Oct 30, 2009 at 7:42 PM, Yaakov Nemoy loupgaroubl...@gmail.com wrote: 2009/10/30 Peter Verswyvelen bugf...@gmail.com: The

Re: [Haskell-cafe] How to fulfill the code-reuse destiny of OOP?

2009-10-31 Thread Magicloud Magiclouds
After all, I never think OO as an oppsite way to all other things. The idea is so general that if you say I cannot use it in Haskell at all, that would make me feel weird. The only difference between languages is, some are easy to be in OO style, some are not. 2009/10/31 Andrew Coppin

Re: [Haskell-cafe] How to fulfill the code-reuse destiny of OOP?

2009-10-31 Thread Tom Davie
On 10/31/09, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: After all, I never think OO as an oppsite way to all other things. The idea is so general that if you say I cannot use it in Haskell at all, that would make me feel weird. The only difference between languages is, some are

Re: [Haskell-cafe] How to fulfill the code-reuse destiny of OOP?

2009-10-31 Thread Eugene Kirpichov
Yoda Master tells understands he you not, inheritance naked can be how, you clarify please asks he to. 2009/10/31 Magicloud Magiclouds magicloud.magiclo...@gmail.com: Somehow, I agree with you. I think inherit is not evil, the people use it wrong is. The problem here is, inherit is naked right

[Haskell-cafe] ghci REPL output under Haskell Platform on Mac OS X

2009-10-31 Thread Mark Lentczner
My ghci installation has a very annoying behavior: When it takes input, the result is displayed on the same line as the input, overwriting the prompt and input. Viz.: [1015] : ghci GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help Loading package

Re: [Haskell-cafe] Re: Applicative but not Monad

2009-10-31 Thread David Menendez
On Sat, Oct 31, 2009 at 6:22 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Dan Weston wrote: Can you elaborate on why Const is not a monad? return x = Const x fmap f (Const x) = Const (f x) join (Const (Const x)) = Const x This is not  Const , this is the  Identity  monad. The

[Haskell-cafe] creating documentation links failed with cabal install --haddock-options=--hyperlink-source. is this a bug?

2009-10-31 Thread Thomas Hartman
cabal haddock -–hyperlink-source installs documentation with links to source code, which also be on by defualt. cabal install –haddock-options=–hyperlink source does not install hyperlinked source. cabal install –haddock-options=-–hyperlink sourceblehblehbleh doesn’t throw an error, which

Re: [Haskell-cafe] GHC core packages: same core?

2009-10-31 Thread Tim Chevalier
On 10/13/09, Dimitry Golubovsky golubov...@gmail.com wrote: Max, Thanks for the explanation. So, the extcore library is expected to match the spec in http://www.haskell.org/ghc/docs/6.10.4/html/ext-core/core.pdf and the core itself can be produced with -fext-core, correct? I think it

Re: [Haskell-cafe] AND/OR Perceptron

2009-10-31 Thread Ryan Ingram
On Thu, Oct 29, 2009 at 1:32 PM, Hector Guilarte hector...@gmail.comwrote: Thanks Tim! I got it! I have never declared a function before in a let ... in statement, I always do it in a where after I call it... where is just syntactic sugar for let...in -- ryan

Re: [Haskell-cafe] Re: Applicative but not Monad

2009-10-31 Thread Ryan Ingram
On Sat, Oct 31, 2009 at 8:38 AM, David Menendez d...@zednenem.com wrote: On Sat, Oct 31, 2009 at 6:22 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: The only possible monad instance would be return x = Const mempty fmap f (Const b) = Const b join (Const b) = Const b

Re: [Haskell-cafe] AND/OR Perceptron

2009-10-31 Thread Chaddaï Fouché
On Sat, Oct 31, 2009 at 8:09 PM, Ryan Ingram ryani.s...@gmail.com wrote: where is just syntactic sugar for let...in That's not perfectly true : where and let...in don't attach to the same syntactic construction, where attaches to a definition and can works for several guard clauses whereas let

[Haskell-cafe] I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language.

2009-10-31 Thread Shelby Moore
I found the post at the following link to be the most useful in explaining declarative versus imperative: http://www.haskell.org/pipermail/haskell-cafe/2009-September/067000.html Here follows what I want to add to the discussion:

Re: [Haskell-cafe] I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language.

2009-10-31 Thread Shelby Moore
Shelby Moore wrote: The most accurate question should be, How do you add some numbers with minimized instructions?, because it forces them to realize they must order the set. An answer might be, Zero if empty, else order the set, sum the first number with the sum of remainder of the set.

[Haskell-cafe] Re: Suggested algorithm to control upper bound of space leaks

2009-10-31 Thread Shelby Moore
http://www.haskell.org/pipermail/cvs-ghc/2009-October/050928.html Shelby Moore wrote: One possible runtime optimization to provide an upper bound for cache control, might be to not cache thunks when the runtime computation time times number of cache hits, is less than the round-trip paging time

[Haskell-cafe] ANN: mecha-0.0.1

2009-10-31 Thread Tom Hawkins
Mecha is a little solid modeling language intended for machine design. Mecha has two layers: a pure functional layer for defining solids (aka. parts), and a monadic layer for arranging parts into assemblies. Solids (parts) are built using set operations on solid primitives. A solid primitives

[Haskell-cafe] Newcomers question

2009-10-31 Thread b1g3ar5
I'm trying: instance Num b = Num (a - b) where fromInteger = pure . Prelude.fromInteger negate = fmap Prelude.negate (+) = liftA2 (Prelude.+) (*) = liftA2 (Prelude.*) abs = fmap Prelude.abs signum = fmap Prelude.signum but the compiler rejects it with: src\Main.hs:24:9: Could not deduce

[Haskell-cafe] ANN: Advgame 0.1.1

2009-10-31 Thread Tim Wawrzynczak
Hey cafe, If any of you were (or are) Common Lispers, you may be aware of Dr. Conrad Barski's humorous and lighthearted approach to Common Lisp. As a little tribute to his CL evangelization efforts, I ported his tutorial, 'Casting SPELs in Lisp' (http://www.lisperati.com/casting.html) to

Re: [Haskell-cafe] Newcomers question

2009-10-31 Thread Henning Thielemann
On Sat, 31 Oct 2009, b1g3ar5 wrote: I'm trying: instance Num b = Num (a - b) where fromInteger = pure . Prelude.fromInteger negate = fmap Prelude.negate (+) = liftA2 (Prelude.+) (*) = liftA2 (Prelude.*) abs = fmap Prelude.abs signum = fmap Prelude.signum but the compiler rejects it with:

Re: [Haskell-cafe] Newcomers question

2009-10-31 Thread Daniel Peebles
For some reason, Show and Eq are superclasses of Num (despite Num not actually using any of their methods), meaning that the compiler forces you to write instances of Eq and Show before it even lets you write a Num instance. I don't think anybody likes this, but I think we're stuck with it for the

Re: [Haskell-cafe] ANN: mecha-0.0.1

2009-10-31 Thread Luke Palmer
Neat! What a cool idea. On Sat, Oct 31, 2009 at 5:27 PM, Tom Hawkins tomahawk...@gmail.com wrote: Mecha is a little solid modeling language intended for machine design.  Mecha has two layers: a pure functional layer for defining solids (aka. parts), and a monadic layer for arranging parts

Re: [Haskell-cafe] How to fulfill the code-reuse destiny of OOP?

2009-10-31 Thread Gregory Collins
Tom Davie tom.da...@gmail.com writes: On 10/31/09, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: After all, I never think OO as an oppsite way to all other things. The idea is so general that if you say I cannot use it in Haskell at all, that would make me feel weird. The only

Re: [Haskell-cafe] How to fulfill the code-reuse destiny of OOP?

2009-10-31 Thread Michael Vanier
Gregory Collins wrote: Tom Davie tom.da...@gmail.com writes: On 10/31/09, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: After all, I never think OO as an oppsite way to all other things. The idea is so general that if you say I cannot use it in Haskell at all, that would

Re: [Haskell-cafe] How to fulfill the code-reuse destiny of OOP?

2009-10-31 Thread Sebastian Sylvan
On Sun, Nov 1, 2009 at 2:00 AM, Michael Vanier mvanie...@gmail.com wrote: Gregory Collins wrote: Tom Davie tom.da...@gmail.com writes: On 10/31/09, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: After all, I never think OO as an oppsite way to all other things. The idea is

[Haskell-cafe] The (|) function in Control.Parallel.Strategies

2009-10-31 Thread Wei Hu
The documentation of (|) says that it evaluates the first argument before the second. The function is defined as (http://www.haskell.org/ghc/docs/6.10-latest/html/libraries/parallel/src/Control-Parallel-Strategies.html#%3E|): (|) :: Done - Done - Done {-# INLINE (|) #-} (|) = Prelude.seq I'm