Re: [Haskell-cafe] vector to uvector and back again

2010-02-11 Thread Dan Doel
On Thursday 11 February 2010 12:43:10 pm stefan kersten wrote: > On 10.02.10 19:03, Bryan O'Sullivan wrote: > > I'm thinking of switching the statistics library over to using vector. > > that would be even better of course! an O(0) solution, at least for me ;) > let me know if i can be of any help

Re: [Haskell-cafe] vector to uvector and back again

2010-02-11 Thread Dan Doel
On Thursday 11 February 2010 9:57:40 pm Roman Leshchinskiy wrote: > Oh no, it hasn't. In contrast to uvector/DPH, which use a custom strict > tuple type for rather outdated reasons, vector uses normal tuples. For > instance, Data.Vector.Unboxed.Vector (a,b,c) is internally represented as > a tripl

Re: [Haskell-cafe] vector to uvector and back again

2010-02-12 Thread Dan Doel
On Thursday 11 February 2010 8:54:15 pm Dan Doel wrote: > On Thursday 11 February 2010 12:43:10 pm stefan kersten wrote: > > On 10.02.10 19:03, Bryan O'Sullivan wrote: > > > I'm thinking of switching the statistics library over to using vector. > > > > tha

Re: [Haskell-cafe] vector to uvector and back again

2010-02-12 Thread Dan Doel
On Friday 12 February 2010 8:12:51 am Roman Leshchinskiy wrote: > That's actually a conscious decision. Since vectors support O(1) slicing, > you can simply copy a slice of the source vector into a slice of the > target vector. Ah! I hadn't thought of that. That makes sense. > At the moment, it i

Re: [Haskell-cafe] vector to uvector and back again

2010-02-25 Thread Dan Doel
On Friday 26 February 2010 12:13:56 am Bryan O'Sullivan wrote: > Dan, do you think you might be releasing your port of uvector-algorithms to > vector any time soon? I've ported mwc-random to use vector, and I'd like to > move statistics (which needs uvector-algorithms) and criterion (ditto) too. I

Re: [Haskell-cafe] What are "free" Monads?

2010-02-27 Thread Dan Doel
On Saturday 27 February 2010 3:54:25 am Günther Schmidt wrote: > I see the term "free monad" quite a lot, but don't really see an > explanation what a free monad is. What sets a monad free and why in this > day and age are there unfree monads? Free structures originate (I think) in algebra. There

Re: [Haskell-cafe] What are "free" Monads?

2010-03-01 Thread Dan Doel
On Monday 01 March 2010 12:50:21 pm Henning Thielemann wrote: > On Sat, 27 Feb 2010, Dan Doel wrote: > > Free structures originate (I think) in algebra. There you'll find talk of > > free groups, free rings, free monoids, etc. > > How about turning this post int

Re: [Haskell-cafe] Re: generalized newtype deriving allows the definition of otherwise undefinable functions

2010-03-09 Thread Dan Doel
On Tuesday 09 March 2010 9:36:51 am Maciej Piechotka wrote: > On Mon, 2010-03-08 at 23:32 +0100, Wolfgang Jeltsch wrote: > > For > > example, with the above conv method, you could probably convert a list > > of some > > type [t] into a list of type [Wrapped t] in O(1) time. If you would > > code th

Re: [Haskell-cafe] Re: ANN: data-category, restricted categories

2010-03-31 Thread Dan Doel
On Tuesday 30 March 2010 4:34:10 pm Ashley Yakeley wrote: > Worse than that, if bottom is a value, then Hask is not a category! Note > that while undefined is bottom, (id . undefined) and (undefined . id) > are not. Hask can be a category even if bottom is a value, with slight modification. That

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Dan Doel
On Friday 07 May 2010 7:54:21 pm Limestraël wrote: > > Personally I think fail is a terrible wart, and should be shunned. > > So do I. > I can't understand its purpose since monads which can fail can be > implemented through MonadPlus. Understanding why fail exists requires going back to before H

Re: [Haskell-cafe] Re: Math questions

2010-05-26 Thread Dan Doel
On Wednesday 26 May 2010 5:38:57 pm Pete Chown wrote: > test :: (Eq a) => (Int -> a) -> (Int -> a) -> Bool > test f1 f2 = unsafePerformIO $ do > goodSoFar <- newIORef True > forLoop 1 100 $ \i -> >when (f1 i /= f2 i) $ writeIORef goodSoFar False > readIORef goodSoFar The pro

Re: [Haskell-cafe] currying combinators

2010-05-27 Thread Dan Doel
On Thursday 27 May 2010 3:27:58 am wren ng thornton wrote: > By parametricty, presumably. Actually, I imagine the way he proved it was to use djinn, which uses a complete decision procedure for intuitionistic propositional logic. The proofs of theorems for that logic correspond to total function

Re: [Haskell-cafe] currying combinators

2010-05-27 Thread Dan Doel
On Thursday 27 May 2010 1:49:36 pm wren ng thornton wrote: > Sure, that's another option. But the failure of exhaustive search isn't > a constructive/intuitionistic technique, so not everyone would accept > the proof. Djinn is essentially an implementation of reasoning by > parametricity, IIRC, so

Re: [Haskell-cafe] Chuch encoding of data structures in Haskell

2010-05-27 Thread Dan Doel
On Thursday 27 May 2010 7:15:15 pm Brandon S. Allbery KF8NH wrote: > On May 27, 2010, at 19:07 , Brandon S. Allbery KF8NH wrote: > > reordered_cons :: (t -> (t1 -> t2)) -> t -> (t1 -> t2) > > churchedNumeral :: (t -> t ) -> t -> t > > > > t unifies with (t1 -> t2), giving us a Church nume

Re: [Haskell-cafe] Re: Math questions

2010-05-27 Thread Dan Doel
On Thursday 27 May 2010 9:05:40 pm Ivan Miljenovic wrote: > On 28 May 2010 09:37, Richard O'Keefe wrote: > > On May 27, 2010, at 11:50 PM, Yitzchak Gale wrote: > >> agree100 = (==) `on` for [1..100] > > > > Search for "on" and "for" in the Haskell 98 Report and you > > will not find them. If you

Re: [Haskell-cafe] A question on existential types and Church encoding

2010-05-30 Thread Dan Doel
On Sunday 30 May 2010 12:28:36 am Cory Knapp wrote: > >type CB a = a -> a -> a > > > >ct :: CB aC > >ct x y = x > > > >cf :: CB a > >cf x y = y > > > >cand :: CB (CB a) -> CB a -> CB a > >cand p q = p q cf > > > >cor :: CB (CB a) -> CB a -> CB a > >cor p q = p ct q The reason these types are requi

Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-01 Thread Dan Doel
On Tuesday 01 June 2010 3:40:41 pm Cory Knapp wrote: > > Note: this is universal quantification, not existential. > > > As I would assume. But I always see the "forall" keyword used when > discussing "existential quantification". I don't know if I've ever seen an > "exists" keyword. Is there one?

Re: [Haskell-cafe] A Finally Tagless Pi Calculus

2010-06-09 Thread Dan Doel
On Wednesday 09 June 2010 2:32:29 pm Dupont Corentin wrote: > I am making a little GATD: > > {-# LANGUAGE GADTs#-} > > > > data Obs a where > > > > Equal :: Obs a -> Obs a -> Obs Bool > > Plus :: (Num a) => Obs a -> Obs a -> Obs a > > (etc..) > > > instance Show t => Show (Obs t) where

Re: [Haskell-cafe] new recursive do notation (ghc 6.12.x) spoils layout

2010-06-20 Thread Dan Doel
On Sunday 20 June 2010 9:24:54 pm Alexander Solla wrote: > Why can't you just use let notation do deal with the recursion? I > thought "lets" in do blocks were just a little bit of syntactic sugar > for "regular" let expressions, which do allow mutual recursion. I > could be totally wrong though.

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Dan Doel
On Sunday 19 April 2009 4:56:29 pm wren ng thornton wrote: > Bulat Ziganshin wrote: > > Hello R.A., > > > > Sunday, April 19, 2009, 11:46:53 PM, you wrote: > >> Does anybody know if there are any plans to incorporate some of > >> these extensions into GHC - specifically the existential typing ? > >

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Dan Doel
On Sunday 19 April 2009 7:11:51 pm wren ng thornton wrote: > Yes, however, because consumers (e.g. @f@) demand that their arguments > remain polymorphic, anything which reduces the polymorphism of @a@ in > @x@ will make it ineligible for being passed to consumers. Maybe not > precise, but it works.

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Dan Doel
On Sunday 19 April 2009 9:31:27 pm Derek Elkins wrote: > > simply because this is essentially a function with type > > > > (forall a. F a) -> (exists a. F a) > > > > and you can do that by instantiating the argument to any type, and then > > hiding it in an existential), > > You can do this by us

Re: [Haskell-cafe] Functor and Haskell

2009-04-23 Thread Dan Doel
On Thursday 23 April 2009 2:44:48 pm Daryoush Mehrtash wrote: > Thanks for this example I get the point now. (at least i think i do :) ) > > One more question This all being on the same category then the functor > transformation can also be view as a simple morphism too. In this example > the

Re: [Haskell-cafe] unsafeSTToIO and stToIO

2009-04-29 Thread Dan Doel
On Wednesday 29 April 2009 5:26:46 pm Xiao-Yong Jin wrote: > Hi, > > Between the following two functions > > stToIO:: ST RealWorld a -> IO a > stToIO (ST m) = IO m > > unsafeSTToIO :: ST s a -> IO a > unsafeSTToIO (ST m) = IO (unsafeCoerce# m) > > All I can see is that the safe one uses Rea

Re: [Haskell-cafe] Unfold fusion

2009-05-06 Thread Dan Doel
On Wednesday 06 May 2009 11:27:08 am Adrian Neumann wrote: > Hello, > > I'm trying to prove the unfold fusion law, as given in the chapter > "Origami Programming" in "The Fun of Programming". unfold is defined > like this: > > unfold p f g b = if p b then [] else (f b):unfold p f g (g b) > > And th

Re: [Haskell-cafe] Unfold fusion

2009-05-06 Thread Dan Doel
On Wednesday 06 May 2009 4:26:15 pm Dan Doel wrote: > unfortunately it looks like I'm doing something wrong in that "coinductive > hypothesis" Sorry about the self-reply, but I realized where I went wrong. The principle of proof by coinduction for defining a function 'f

Re: [Haskell-cafe] Structural sharing in haskell data structures?

2009-05-14 Thread Dan Doel
On Thursday 14 May 2009 9:03:30 am Jan-Willem Maessen wrote: > Hmm, I think neither of the data structures you name actually support > both O(lg n) indexing and O(lg n) cons or append. That said, your > point is well taken, so let's instead state it as a challenge: Data.Sequence has O(log n) inde

Re: [Haskell-cafe] Getting my mind around UArray -> STUArray conversion

2009-06-19 Thread Dan Doel
On Friday 19 June 2009 9:43:29 pm Scott Michel wrote: > wombat :: (IArray UArray e, Ix ix, MArray (STUArray s) e (ST s)) => e > -> ix -> UArray ix e -> UArray ix e > wombat val idx mem = (unsafeThaw mem :: ST s (STUArray s ix e)) >>= > (\mmem -> unsafeFreeze mmem) Based on the error message and de

Re: [Haskell-cafe] Getting my mind around UArray -> STUArray conversion

2009-06-19 Thread Dan Doel
Oops, I replied too hastily. What I wrote in my first mail is a problem, as witnessed by the "ix" and "ix1" in the error message. However, it isn't the main error. The main error is that you have a monadic expression, with type something like: ST s (UArray ix e) but the return type of your

Re: [Haskell-cafe] How to read safely?

2009-06-24 Thread Dan Doel
On Wednesday 24 June 2009 5:40:28 am Magicloud Magiclouds wrote: > Hi, > Read often throws runtime errors, which breaks the robust of the > problem. How to deal with it? Without lost too much proformance (so > reads is a no). > At least, if its error could be catched, that'd be better. There w

Re: [Haskell-cafe] golf, predicate check function for MonadPlus (was Re: How to read safely?)

2009-07-06 Thread Dan Doel
On Thursday 02 July 2009 6:36:09 am Jon Fairbairn wrote: > check :: (MonadPlus m) => (a -> Bool) -> a -> m a > check p a > | p a = return a > | otherwise = mzero > > I tried Hoogling for a function like check, but couldn't find it. Surely > there's one in a library somewhere? It looks usefu

Re: [Haskell-cafe] Alternative IO

2009-07-10 Thread Dan Doel
On Friday 10 July 2009 4:35:15 am Wolfgang Jeltsch wrote: > I fear that this instance doesn’t satisfy required laws. As far as I know, > the following equalities should hold: > > (*>) = (>>) > > f *> empty = empty IO already fails at this law, because (f *> empty) is not the same as empty,

Re: [Haskell-cafe] Re: Adding an ignore function to Control.Monad

2009-07-11 Thread Dan Doel
On Saturday 11 July 2009 3:35:27 am Jeff Wheeler wrote: > On Fri, Jul 10, 2009 at 10:10 PM, Don Stewart wrote: > >> ## Control.Monad.void m a -> m () > >> Don Stewart > >> Iavor Diatchki > > For whatever it's worth, I prefer void as well, for the exact reason > Don said. Indeed, 'ignore' indicates

Re: [Haskell-cafe] Type families and polymorphism

2009-07-11 Thread Dan Doel
On Saturday 11 July 2009 2:31:28 pm Jeremy Yallop wrote: > Why does compiling the following program give an error? > > > {-# LANGUAGE TypeFamilies, RankNTypes #-} > > > > type family TF a > > > > identity :: (forall a. TF a) -> (forall a. TF a) > > identity x = x > > GHC 6.10.3 gives me: > > C

Re: [Haskell-cafe] Re: Is a bug?

2009-07-26 Thread Dan Doel
On Sunday 26 July 2009 10:54:53 pm Linker wrote: > Sorry.I defined a function : > > *GHCi, version 6.10.3: http://www.haskell.org/ghc/ :? for help* > *Loading package ghc-prim ... linking ... done.* > *Loading package integer ... linking ... done.* > *Loading package base ... linking ... done.* >

Re: [Haskell-cafe] Re: Proposal: TypeDirectedNameResolution

2009-07-28 Thread Dan Doel
On Tuesday 28 July 2009 8:27:53 pm Richard O'Keefe wrote: > Right. That settles it: TDNR is a bad idea. > Half fun and full earnest. > > I'm a fan of overloading as done in Ada, but the way > C++ does it has always struck me as a mix of under-useful > and over-complex, and my experience with it i

Re: DDC compiler and effects; better than Haskell? (was Re: [Haskell-cafe] unsafeDestructiveAssign?)

2009-08-12 Thread Dan Doel
On Wednesday 12 August 2009 10:12:14 am John A. De Goes wrote: > I think the point is that a functional language with a built- > in effect system that captures the nature of effects is pretty damn > cool and eliminates a lot of boilerplate. It's definitely an interesting direction (possibly even t

Re: DDC compiler and effects; better than Haskell? (was Re: [Haskell-cafe] unsafeDestructiveAssign?)

2009-08-12 Thread Dan Doel
On Wednesday 12 August 2009 9:27:30 pm John A. De Goes wrote: > So what, because effect systems might not eliminate *all* boilerplate, > you'd rather use boilerplate 100% of the time? :-) For most of my Haskell programs, the majority of the program is not made up of straight IO or ST functions, s

Re: DDC compiler and effects; better than Haskell? (was Re: [Haskell-cafe] unsafeDestructiveAssign?)

2009-08-12 Thread Dan Doel
On Wednesday 12 August 2009 11:46:29 pm Ben Lippmeier wrote: > Dan Doel wrote: > > Off hand, I'd say I don't write foo and fooM versions of functions much > > in actual programs, either. Such duplication goes into libraries... > > It would be ok if the duplication

Re: [Haskell-cafe] Calling function with unknown number and type arguments

2009-08-16 Thread Dan Doel
On Sunday 16 August 2009 8:35:19 pm Antoine Latter wrote: > But with those, the number of arguments is still known at compile time, > correct? {-# LANGUAGE Rank2Types #-} import Text.Printf import System.Environment nprintf :: PrintfType t => Int -> Int -> t nprintf n e = aux (printf str) n whe

Re: [Haskell-cafe] Observations about foldM

2009-08-19 Thread Dan Doel
On Wednesday 19 August 2009 12:14:24 am Jason McCarty wrote: > Interestingly, foldM can also be written as a left fold. To see this, note > that it is a theorem that foldr f z xs = foldl f z xs as long as f is > associative and z is a unit for f. It must also be the case that xs is finite in lengt

Re: [Haskell-cafe] Is it possible to prove type *non*-equality in Haskell?

2009-08-25 Thread Dan Doel
On Tuesday 25 August 2009 6:03:31 pm Ryan Ingram wrote: > > proveEq :: Nat a -> Nat b -> Maybe (TEq a b) > > proveEq Nz Nz = return TEq > > proveEq (Ns a) (Ns b) = do > > TEq <- proveEq a b > > return TEq > > proveEq _ _ = Nothing > > But if you get "Nothing" back, there's no proof that the

Re: [Haskell-cafe] Re: Don't “accidentallyparallelize”

2009-09-05 Thread Dan Doel
On Saturday 05 September 2009 9:13:50 am Gracjan Polak wrote: > [quote] > Indeed, if GHC was in the habit of causing the second argument of seq to be > evaluated before the first, then a lot of people would probably be > surprised. eg. imagine what happens to foldl': > > foldl' f a [] = a >

Re: [Haskell-cafe] Re: Don't “accidentallyparallelize”

2009-09-06 Thread Dan Doel
On Sunday 06 September 2009 2:18:31 am David Menendez wrote: > On Sat, Sep 5, 2009 at 7:57 PM, Dan Doel wrote: > > I suppose technically, what foldl' has over foldl is that it is more > > readily subject to optimization. Each recursive call is artificially made > > strict

[Haskell-cafe] ANNOUNCE: uvector-algorithms 0.2

2009-09-08 Thread Dan Doel
Greetings, It is my pleasure to announce version 0.2 of the uvector-algorithms package. The package so far has implementations of several sorting and selection algorithms for use on the mutable arrays from the uvector library, as well as combinators for applying them to immutable arrays. New d

Re: [Haskell-cafe] Just for a laugh...

2007-06-01 Thread Dan Doel
On Friday 01 June 2007, Andrew Coppin wrote: > David Roundy wrote: > > Note also that you can use unsafePerformIO to safely get pure functions > > doing both these operations. > > I've always been puzzled by this one... how does unsafePerformIO > circumvent the type system? I don't understand. imp

Re: [Haskell-cafe] IDE?

2007-06-18 Thread Dan Doel
On Monday 18 June 2007, Jon Harrop wrote: > On Monday 18 June 2007 05:39:21 Derek Elkins wrote: > > Not directed at Michael Richter specifically: > > > > I don't normally say this stuff, but this discussion has drifted onto > > topics that have nothing to do with Haskell. I personally would like >

[Haskell-cafe] Playing with delimited continuations

2007-07-04 Thread Dan Doel
I'm using the most definitive and recent on the subject of implementing delimited continuations in Haskell? I did some quick google searches, but nothing much turned up besides this paper, and some papers using the implementation in examples of using delimited continua

[Haskell-cafe] Re: Playing with delimited continuations

2007-07-05 Thread Dan Doel
riting so many of them in the first place. :) Incidentally, I really enjoyed your "Delimited continuations in operating systems" paper. Reading that one really made things click for me as to how delimited continuations can actually show up in real systems, as opposed to just being an e

[Haskell-cafe] ANNOUNCE: logict-0.2

2007-07-07 Thread Dan Doel
ation described therein. Hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/logict-0.2 Tarball: http://hackage.haskell.org/packages/archive/logict/0.2/logict-0.2.tar.gz Feel free to let me know if your find any bugs, or have suggestions. Dan Doel [1]: http://okmij.org/ftp/pa

Re: [Haskell-cafe] Indentation Creep

2007-07-13 Thread Dan Doel
In addition to what's already been pointed out, note that this: > do t <- readTVar p > case t of > Empty -> return Nothing > Trie l m r -> do Is a case of the (non-existent) MaybeT transformer: > do Trie l m r <- readTVar p > The modifications being something like 'ret

[Haskell-cafe] ANNOUNCE: CC-delcont-0.1; Delimited continuations for Haskell

2007-07-15 Thread Dan Doel
x27;s interest. Please feel free to let me know if you find any bugs, or have any suggestions for improvements. I'll follow up this message with a message containing an example program and a discussion thereof. Cheers, Dan Doel 1: http://www.cs.indiana.edu/~sabry/papers/monadicDC.pdf 2:

[Haskell-cafe] Re: ANNOUNCE: CC-delcont-0.1; Delimited continuations for Haskell

2007-07-15 Thread Dan Doel
quation, it's not a correct parse, though it may be a prefix to one), and the above method won't be able to restart as closely to an error as one that, say, saved after each input but resumed when legitimately bad input automatically kicked the parser to Done. Whether this is enough motivati

[Haskell-cafe] Re: ANNOUNCE: CC-delcont-0.1; Delimited continuations for Haskell

2007-07-16 Thread Dan Doel
avenue, so I don't know if it helps in actually writing functions that *use* such data structures (and it might kill your ability to deforest/use an optimized representation underneath). However, I thought it was a cute use of the sort of thing you're likely to see in papers that apply cat

Re: [Haskell-cafe] Why does Data.Map exist when...

2007-07-16 Thread Dan Doel
or that key type without our having to do anything. And the answer to that is that maybe, in the future, that will be the case, once associated types/data families are widely available. :) Cheers, Dan Doel ___ Haskell-Cafe mailing list Haskell-Cafe@has

Re: [Haskell-cafe] advantages of using fix to define rcursive functions

2007-07-26 Thread Dan Doel
On Thursday 26 July 2007, Harald ROTTER wrote: > Hi, > > I read about the usage of "fix" to define recursive functions. Although I > think that I understood how to use "fix", I still wonder what the > advantages of "fix" are (as compared to the "conventional" approach to > define recursive function

Re: [Haskell-cafe] Polymorphic variants

2007-08-02 Thread Dan Doel
On Thursday 02 August 2007, Jon Harrop wrote: > On Thursday 26 July 2007 00:07:23 Josef Svenningsson wrote: > > On 7/26/07, Jon Harrop <[EMAIL PROTECTED]> wrote: > > > Does Haskell have anything similar to OCaml's polymorphic variants? > > > > No as such, but it's possible to simulate them. As alwa

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Dan Doel
On Friday 03 August 2007, Sebastian Sylvan wrote: > On 03/08/07, Claus Reinke <[EMAIL PROTECTED]> wrote: > > ah, a concrete example. but isn't that the typical use case for ap? > > > > mytransaction = foo `liftM` r xvar0 `ap` r xvar1 .. > > where r = readTVar > > I really find it difficult to a

Re: [Haskell-cafe] Why isn't pattern matching lazy by default?

2007-09-19 Thread Dan Doel
On Wednesday 19 September 2007, C.M.Brown wrote: > g is strict in its first argument. Declared in a let it would look like: > > f x = let g x = case x of >(Just y) -> y >Nothing -> error "Nothing" in g x > > Again, g must be strict in its first argument. A

Re: [Haskell-cafe] agda v. haskell

2007-09-28 Thread Dan Doel
On Friday 28 September 2007, brad clawsie wrote: > dons has been posting some links regarding agda on reddit. fairly > interesting, a quick glance and you think you are reading haskell > code. > > does anyone have any insights on the major differences in these > languages? I'm not too familiar wit

Re: [Haskell-cafe] Dynamic choice of "reverse" implementation

2007-09-28 Thread Dan Doel
On Friday 28 September 2007, David Benbennick wrote: > On 9/28/07, Ross Paterson <[EMAIL PROTECTED]> wrote: > > However one can define > > > > reversor :: Traversable f => f a -> f a > > > > which returns something of the same shape, but with the contents > > reversed. > > How? Is it possi

Re: [Haskell-cafe] Can every monad can be implemented with Cont? (was: New slogan for haskell.org)

2007-10-13 Thread Dan Doel
On Saturday 13 October 2007, Albert Y. C. Lai wrote: > jeff p wrote: > > I think this is referring to Andrzej Filinski's paper "Representing > > Layered Monads" in which it shown that stacks of monads can be > > implemented directly (no layering) by using call/cc and mutable state. > > I have been

[Haskell-cafe] Announce: CC-delcont 0.2

2008-02-01 Thread Dan Doel
tinuations, changes are welcome.) Once again, if you discover any bugs, or have any suggestions, don't hesitate to let me know. -- Dan Doel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: checking types with type families

2010-07-02 Thread Dan Doel
On Friday 02 July 2010 6:23:53 pm Claus Reinke wrote: > -- second, while trying the piece with classic, non-equality constraints > Prelude> (id :: (forall b. Eq b=>b->b) -> (forall b. Eq b=>b->b)) > > :1:0: > No instance for (Show ((forall b1. (Eq b1) => b1 -> b1) -> b -> b)) > arising f

Re: [Haskell-cafe] checking types with type families

2010-07-03 Thread Dan Doel
On Saturday 03 July 2010 2:11:37 pm David Menendez wrote: > > {-# LANGUAGE MultiParamTypeClasses #-} > > {-# LANGUAGE FunctionalDependencies #-} > > {-# LANGUAGE FlexibleInstances, UndecidableInstances #-} > > > > class C a b c | a -> b, a -> c where > >op :: a -> b -> c > > > > instance C Bo

Re: [Haskell-cafe] What is the point of many and some functions in Control.Applicative (for Alternative?)

2010-07-03 Thread Dan Doel
On Saturday 03 July 2010 3:57:34 pm Thomas Hartman wrote: > When I load up Control.Applicative in ghci and try, eg > > many [1,2] or many (Just 1) or some [1,2] or some (Just 1) > > this never returns. > > What are the practical uses of these combinators, or for using the > Alternative class in

Re: [Haskell-cafe] checking types with type families

2010-07-03 Thread Dan Doel
On Saturday 03 July 2010 4:01:12 pm Kevin Quick wrote: > As a side note, although I agree it abuses the fundeps intent, it was handy > for the specific purpose I was implementing to have a "no-op/passthrough" > instance of op. In general I like the typedef approach better, but it > looks like I mu

Re: [Haskell-cafe] Rank2Types and pattern matching

2010-07-03 Thread Dan Doel
On Saturday 03 July 2010 7:24:17 pm Yves Parès wrote: > I'm trying to implement the type protection used by ST to prevent a monad > from returning a certain type. > There's my code: > > import Control.Monad.Identity > > newtype SomeMonad s a = SomeMonad { unSome :: Identity a } > deriving (Mona

Re: [Haskell-cafe] Rank2Types and pattern matching

2010-07-03 Thread Dan Doel
On Saturday 03 July 2010 10:52:31 pm Felipe Lessa wrote: > I understood your explanation. However, is this an implementation > detail/bug or is it an intended feature? Well, I wouldn't call it a bug. Perhaps it could be called a lack of a feature, because one can imagine such pattern matches bei

Re: [Haskell-cafe] Rank2Types and pattern matching

2010-07-04 Thread Dan Doel
On Sunday 04 July 2010 5:41:07 am Yves Parès wrote: > Okay, I understand better, now. > But I could never have guessed it just from the GHC error message. > > Another question on the same code: > > import Control.Monad.Identity > > newtype SomeMonad s a = SomeMonad { unSome :: Identity a } > d

Re: [Haskell-cafe] monoids and monads

2010-07-27 Thread Dan Doel
On Tuesday 27 July 2010 8:50:56 am Henning Thielemann wrote: > I always assumed that 'm a' would be a monoid for 'm' being an > applicative functor, but I never tried to prove it. Now you made me > performing a proof. However the applicative functor laws from > http://www.haskell.org/ghc/docs/6.12.

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-07-31 Thread Dan Doel
On Saturday 31 July 2010 8:13:37 am Ertugrul Soeylemez wrote: > I agree to some extent, but only to some. Mostly the problem of people > is that they are trying to understand "monads" as opposed to specific > instances. It's better to learn "the IO monad", "state monads", "the > list monad", "the

Re: [Haskell-cafe] Laziness question

2010-08-01 Thread Dan Doel
On Sunday 01 August 2010 10:52:48 am Felipe Lessa wrote: > On Sun, Aug 1, 2010 at 11:29 AM, Nicolas Pouillard > > wrote: > > Finally maybe we can simply forbidden the forcing of function (as we do > > with Eq). The few cases where it does matter will rescue to > > unsafeSeqFunction. > > What's t

Re: [Haskell-cafe] lambdacats

2010-08-06 Thread Dan Doel
> I remember the first lambdacat said something like "why can't u curry > this funkshun". I don't see it in this list. :-( Simon cat and Oleg cat are also missing, unfortunately. Also the 'catamorphism' picture with the banana peel (there may be others I can't recall, too). _

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-11 Thread Dan Doel
On Wednesday 11 August 2010 9:49:07 am mo...@deepbondi.net wrote: > The mixture is not as free as some would like; the fact that Haskell has > this distinction between monadic actions and pure values (and the fact > that the former can be manipulated as an instance of the latter) means > that the p

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-11 Thread Dan Doel
On Wednesday 11 August 2010 3:13:56 pm Tillmann Rendel wrote: > I understand your argument to be the following: Functional languages are > built upon the lambda calculus, so a *pure* functional language has to > preserve the equational theory of the lambda calculus, including, for > example, beta r

Re: [Haskell-cafe] universal quantification is to type instantiations as existential quantification is to what

2010-08-12 Thread Dan Doel
On Thursday 12 August 2010 7:59:09 pm wren ng thornton wrote: > Not quite. Strong-sigma is a dependent pair where you can project both > elements. Weak-sigma is a dependent pair where you can only project the > first element (because the second is erased). Existentials are dependent > pairs where y

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-13 Thread Dan Doel
On Friday 13 August 2010 8:51:46 pm Evan Laforge wrote: > I have an app that is using Data.Text, however I'm thinking of > switching to UTF8 bytestrings. The reasons are that there are two > main things I do with text: pass it to a C API to display, and parse > it. The C API expects UTF8, and the

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-18 Thread Dan Doel
On Wednesday 18 August 2010 11:14:06 am Ertugrul Soeylemez wrote: > > loop, loop' :: IO () > > loop = loop > > loop' = putStr "c" >> loop' > > Huh?! Let's translate them. 'loop' becomes: > > undefined > > But 'loop\'' becomes: > > \w0 -> let (w1, ()) = putStr "c" w0 >

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-18 Thread Dan Doel
On Wednesday 18 August 2010 2:50:00 pm Gregory Crosswhite wrote: > On 08/18/10 11:30, Dan Doel wrote: > > Now, moving to the two loops: > > loop = loop > > loop' = \w0 -> let (w1, ()) = putStr "c" w0 in loop' w1 > > > > How are we to

Re: [Haskell-cafe] Type families - how to resolve ambiguities?

2010-08-25 Thread Dan Doel
On Wednesday 25 August 2010 5:05:11 pm DavidA wrote: > Hi, > > The code below defines a type synonym family: > > {-# LANGUAGE MultiParamTypeClasses, TypeFamilies #-} > {-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-} > > data Vect k b = V [(b,k)] deriving (Eq,Show) > > data TensorBasis

Re: [Haskell-cafe] Restricted type classes

2010-09-10 Thread Dan Doel
On Wednesday 08 September 2010 11:17:43 pm wren ng thornton wrote: > -- | Proof that impure is not p...@e > fmap f (impure a) > == fmap f (E a a) > == E (f a) a > /= E (f a) (f a) > == impure (f a) I don't believe your proof. The type of E is as follows: E :: a ->

Re: [Haskell-cafe] Cost: (:) vs head

2010-09-10 Thread Dan Doel
On Friday 10 September 2010 11:13:50 pm michael rice wrote: > Which of these would be more costly for a long list? > > f :: [Int] -> [Int] > f [x] = [x] > f (x:xs) = x + (head xs) : f xs > > f :: [Int] -> [Int] > > f [x] = [x] > f (x:y:xs) = x + y : f (y:xs) Another option would be: f [x] =

Re: [Haskell-cafe] translating bidirectional fundeps to TFs

2010-09-17 Thread Dan Doel
On Friday 17 September 2010 4:04:26 pm Gábor Lehel wrote: > What I would *want* to write is this: > > class (Mutable (Thawed a), Frozen (Thawed a) ~ a) => Immutable a where > type Thawed a :: * > thaw :: a -> Thawed a > > class (Immutable (Frozen a), Thawed (Frozen a) ~ a) => Mutable a wh

Re: [Haskell-cafe] translating bidirectional fundeps to TFs

2010-09-18 Thread Dan Doel
On Saturday 18 September 2010 8:27:45 am Gábor Lehel wrote: > Hmm. I had a similar thought, but dismissed it because I was under the > impression that you needed to use all the parameters of the class as > parameters of its associated types. But apparently that was mistaken > -- or, at least, your

Re: [Haskell-cafe] Re: Re: Re: Full strict functor by abusing Haskell exceptions

2010-09-18 Thread Dan Doel
On Saturday 18 September 2010 6:03:39 pm wren ng thornton wrote: > pointed objects, pointed sets/groups/topospaces, pointed categories, > pointed functors, etc aren't all the same though. The definition of pointed objects could be massaged to yield pointed functors, though. Instead of a categor

Re: [Haskell-cafe] Monad instance for partially applied type constructor?

2010-09-29 Thread Dan Doel
On Wednesday 29 September 2010 2:52:21 pm Christopher Done wrote: > LiberalTypeSynonyms lets you partially apply type synonyms. Not in general. LiberalTypeSynonyms only allows synonyms to be partially applied when expansions of other type synonyms will eventually cause them to become fully appli

Re: [Haskell-cafe] Re: Re-order type (flip map)

2010-10-10 Thread Dan Doel
On Sunday 10 October 2010 5:32:16 pm Johannes Waldmann wrote: > I mean instead of h . g . f $ x > I'd sometimes prefer x ? f ? g ? h > but what are the "?" Note, before anyone gets too excited about this, there are some built-in things about the language that make forward chaining less nic

Re: Who is afraid of arrows, was Re: [Haskell-cafe] ANNOUNCE: Haskell XML Toolbox Version 9.0.0

2010-10-12 Thread Dan Doel
On Tuesday 12 October 2010 4:02:06 pm Gregory Crosswhite wrote: > Hughes himself said that when your arrow is an instance of ArrowApply, > you are better off just sticking with monads. Well, this is not necessarily good advice. It is true that ArrowApply will preclude some sort of static analysi

Re: [Haskell-cafe] An interesting paper from Google

2010-10-16 Thread Dan Doel
On Saturday 16 October 2010 7:04:23 pm Ben Millwood wrote: > On Fri, Oct 15, 2010 at 9:28 PM, Andrew Coppin > > wrote: > > I'm still quite > > surprised that there's no tool anywhere which will trivially print out > > the reduction sequence for executing an expression. You'd think this > > would

Re: [Haskell-cafe] Re: Eta-expansion and existentials (or: types destroy my laziness)

2010-10-19 Thread Dan Doel
On Tuesday 19 October 2010 6:16:16 am Max Bolingbroke wrote: > Thanks - your definitions are similar to Roman's suggestion. > Unfortunately my criteria 3) is not quite what I actually wanted - I > really wanted something "GHC-optimisable" - (so non-recursive > definitions are a necessary but not s

Re: [Haskell-cafe] Re: Eta-expansion and existentials (or: types destroy my laziness)

2010-10-22 Thread Dan Doel
On Friday 22 October 2010 5:48:28 am Max Bolingbroke wrote: > I think evaluating dictionaries strictly is more of a "want to have" > rather than "actually implemented". In particular, GHC supports > building value-recursive dictionaries - and making dictionary > arguments strict indiscriminately wo

Re: [Haskell-cafe] Scrap your rolls/unrolls

2010-10-22 Thread Dan Doel
On Friday 22 October 2010 6:37:49 am Max Bolingbroke wrote: > This is all well and good, but it means when working with data types > defined in this manner you have to write Roll and unroll everywhere. > This is tedious :-( Your discovery is interesting (and I haven't seen it before). Another sol

Re: [Haskell-cafe] Re: Scrap your rolls/unrolls

2010-10-22 Thread Dan Doel
On Friday 22 October 2010 7:24:37 am Max Bolingbroke wrote: > Ah yes, pattern synonyms. This solution is somewhat unsatisfying > because you will also need some smart constructors: > > """ > nil = Roll NilF > cons x xs = Roll (ConsF x xs) > """ > > Now the names of the smart constructors for buil

Re: [Haskell-cafe] Mysterious fact

2010-11-01 Thread Dan Doel
On Monday 01 November 2010 6:40:30 pm Jeremy Shaw wrote: > Looks a lot like Church encoding to me: > > http://en.wikipedia.org/wiki/Church_encoding > > It was first discovered by the guy who invented lambda calculus :p Also, if you're interested in this, you can read Proofs and Types by Girard

Re: [Haskell-cafe] Can a fundep force parametricity

2010-11-02 Thread Dan Doel
On Tuesday 02 November 2010 4:01:33 pm Brandon Moore wrote: > >instance C Int b where > > > > update _ n = n This instance violates the fundep. The fundep says that the first parameter determines the second. However, this instance is a scheme for declaring infinitely many monomorphic instances

Re: [Haskell-cafe] CPS Error Monad

2010-11-02 Thread Dan Doel
On Tuesday 02 November 2010 3:11:22 pm Brandon Moore wrote: > That's surprising, I think LogicT gains significant performance from that > sort of CPS conversion. It's probably not that surprising. LogicT is an encoding of a recursive type, so there's potentially more causes for the gain. For ins

Re: [OT] Re: [Haskell-cafe] "Haskell is a scripting language inspired by Python."

2010-11-04 Thread Dan Doel
On Thursday 04 November 2010 12:12:51 pm Jeremy O'Donoghue wrote: > Best laugh I've had in ages. Personal favourites are: The Forth one got me. I also like: OCaml: "OCaml is an attempt to implement object-oriented syntax in Caml. It is related to SML." No mention of what Caml is, by the way. H

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-28 Thread Dan Doel
On Thursday 28 August 2008 12:26:27 pm Adrian Hey wrote: > As I've pointed out several times already you can find simple examples > in the standard haskell libs. So far nobody has accepted my challenge to > re-implement any of these "competantly" (I.E. avoiding the use of global > variables). > > W

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-28 Thread Dan Doel
On Thursday 28 August 2008 2:28:35 pm David Roundy wrote: > On Thu, Aug 28, 2008 at 01:17:29PM -0400, Dan Doel wrote: > > On Thursday 28 August 2008 12:26:27 pm Adrian Hey wrote: > > > As I've pointed out several times already you can find simple examples > > > in t

  1   2   3   >