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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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?
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
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.
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 ?
> >
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.
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
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
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
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
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
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
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
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
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
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
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,
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
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
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.*
>
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
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
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
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
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
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
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
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
>
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
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
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
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
>
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
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
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
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
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:
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
> 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).
_
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
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
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
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
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
>
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
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
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 ->
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] =
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 - 100 of 262 matches
Mail list logo