Re: [Haskell-cafe] Good Java book? (not off-topic)
I've always found Bruce Eckel's Thinking in Java the best introductory book to the practice of object oriented programming and Java. There's a sample online http://www.mindviewinc.com/TIJ4/BookSampleDownload.php Whether this is in concordance with FP principles or not is a different thing, but the point is to introduce OO and Java, isn't it? Anyway, I don't think it's damaging if you later get to use Haskell and formal methods (I went myself through that as well). Cheers, ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Category Theory woes
You may try Pierce's Basic Category Theory for Computer Scientists or Awodey's Category Theory, whose style is rather introductory. Both of them (I think) have a chapter about functors where they explain the Hom functor and related topics. Alvaro. 2010/2/2 Mark Spezzano mark.spezz...@chariot.net.au I should probably add that I am trying various proofs that involve injective and surjective properties of Hom Sets and Hom functions. Does anyone know what Hom stands for? I need a text for a newbie. Mark On 02/02/2010, at 9:56 PM, Mark Spezzano wrote: Hi all, I'm trying to learn Haskell and have come across Monads. I kind of understand monads now, but I would really like to understand where they come from. So I got a copy of Barr and Well's Category Theory for Computing Science Third Edition, but the book has really left me dumbfounded. It's a good book. But I'm just having trouble with the proofs in Chapter 1--let alone reading the rest of the text. Are there any references to things like Hom Sets and Hom Functions in the literature somewhere and how to use them? The only book I know that uses them is this one. Has anyone else found it frustratingly difficult to find details on easy-to-diget material on Category theory. The Chapter that I'm stuck on is actually labelled Preliminaries and so I reason that if I can't do this, then there's not much hope for me understanding the rest of the book... Maybe there are books on Discrete maths or Algebra or Set Theory that deal more with Hom Sets and Hom Functions? Thanks, Mark Spezzano. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Strict Monad
Hi, I'm trying to characterise some strict monads to work with a particular lambda-calculus evaluator, as an alternative to CPS monad. In the thread Stupid question #852: Strict monad the implementation of some strict monads (and pseudo-monads, not meeting the identity laws) is discussed. It's clear form that thread that using pattern-matching in the (=) operation will force evaluation, then the Id monad defined with pattern-matching is strict (and it's indeed a monad): newtype Id a = Id a instance Monad Id where return = Id (Id a) = f = f a But it's impossible to derive a monad transformer from it, because you don't know the constructors of the monads you're transforming. I then tried to use strict application ($!). My first attempt was newtype Strict a = InSt { outSt :: a } instance Monad Strict where return = InSt m = f = (\x - f x) $! (outSt m) which is not a monad (doesn't meet the left identity law). (return undefined) = (\x - const (return 1) x) =/=(return 1) Then I wondered if it was enough to force the evaluation of the whole monad, instead of the value inside the monad, yielding the second attempt: newtype Strict a = InSt { outSt :: a } instance Monad Strict where return = InSt m = f = (\x - f (outSt x)) $! m I placed the outSt inside the anonymous function, leaving the monad on the right of the ($!). This meets the identity laws and surprisingly (I was expecting a lazy behaviour) implements strict semantics (it behaves like CPS, which is strict as well). A transformer from this monad can be easily written: newtype StrictT m a = InStT { outStT :: m a } instance Monad m = Monad (StrictT m) where return = InStT . return m = t = InStT $ (\x - x = (\a - outStT $ t a)) $! (outStT m) instance MonadTrans StrictT where lift = InStT Is it common practice to use this monad and this transformer? Why is it not in the standard library? I looked for this monad in the literature but I didn't find anything similar. It seems naive to me that this has never been previously described. Am I doing something wrong and this is not a monad at all? Alvaro. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe