Dominic Steinitz wrote:
Roberto Zunino wrote:
This is the point: eta does not hold if seq exists.
undefined `seq` 1 == undefined
(\x - undefined x) `seq` 1 == 1
Ok I've never used seq and I've never used unsavePerformIO. Provided my
program doesn't contain these then can I assume that eta
Excellent! This has all been very helpful. Thanks a lot everybody! :-)
-Corey
On 12/14/07, Benja Fallenstein [EMAIL PROTECTED] wrote:
Hi Corey,
On Dec 14, 2007 8:44 PM, Corey O'Connor [EMAIL PROTECTED] wrote:
The reason I find all this odd is because I'm not sure how the type
class Functor
keep in mind that Haskell composition (.)
is not really composition in the category-theoretic
sense, because it adds extra laziness. Use this
Do you have a counter-example of (.) not being function composition in
the categorical sense?
___
Do you have a counter-example of (.) not being function composition in
the categorical sense?
Let bot be the function defined by
bot :: alpha - beta
bot = bot
By definition,
(.) = \ f - \ g - \ x - f (g x)
Then
bot . id
= ((\ f - \ g - \ x - f (g x)) bot) id
= (\ g - \ x
Yitzchak Gale wrote:
When using seq and _|_ in the context of categories,
keep in mind that Haskell composition (.)
is not really composition in the category-theoretic
sense, because it adds extra laziness. Use this
instead:
(.!) f g x = f `seq` g `seq` f (g x)
id .! undefined
== \x -
Dominic Steinitz wrote:
This would give
= \x - bot x
and by eta reduction
This is the point: eta does not hold if seq exists.
undefined `seq` 1 == undefined
(\x - undefined x) `seq` 1 == 1
The (.) does not form a category argument should be something like:
id . undefined == (\x -
I wrote:
(.!) f g x = f `seq` g `seq` f (g x)
Roberto Zunino wrote:
id .! undefined
== \x - undefined
/= undefined
Probably you meant
(.!) f g = f `seq` g `seq` (f . g)
Yes, thank you.
-Yitz
___
Haskell-Cafe mailing list
Roberto Zunino writes:
without seq, there is no way to distinguish between undefined and (const
undefined),
no way to distinguish is perhaps too strong. They have slightly
different types.
Jerzy Karczmarczuk
___
Haskell-Cafe mailing list
Roberto Zunino wrote:
Dominic Steinitz wrote:
This would give
= \x - bot x
and by eta reduction
This is the point: eta does not hold if seq exists.
undefined `seq` 1 == undefined
(\x - undefined x) `seq` 1 == 1
Ok I've never used seq and I've never used unsavePerformIO.
Jonathan Cast wrote:
On 16 Dec 2007, at 3:21 AM, Dominic Steinitz wrote:
Do you have a counter-example of (.) not being function composition in
the categorical sense?
Let bot be the function defined by
bot :: alpha - beta
bot = bot
By definition,
(.) = \ f - \ g - \ x - f (g x)
Ah, good old seq. How I loathe it.
Seriously, though, good catch. I always forget about seq when I'm doing
stuff like this.
When using seq and _|_ in the context of categories,
keep in mind that Haskell composition (.)
is not really composition in the category-theoretic
sense, because it adds
I'm working through the interesting paper Data type à la carte and
am confused by the Functor instance for Val. I think this stems from
some confusion of mine regarding the Functor class in general.
The Functor instance I'm confused about is:
instance Functor Val where
fmap f (Val x )
On Dec 14, 2007 11:44 AM, Corey O'Connor [EMAIL PROTECTED] wrote:
I'm working through the interesting paper Data type à la carte and
am confused by the Functor instance for Val. I think this stems from
some confusion of mine regarding the Functor class in general.
I'll try to explain, but I
Hi Corey,
On Dec 14, 2007 8:44 PM, Corey O'Connor [EMAIL PROTECTED] wrote:
The reason I find all this odd is because I'm not sure how the type
class Functor relates to the category theory concept of a functor. How
does declaring a type constructor to be an instance of the Functor
class relate
On Dec 14, 2007 6:37 PM, Benja Fallenstein [EMAIL PROTECTED] wrote:
such that the following two properties hold:
* F(idX) = idF(X) for every object X in C
* F(g . f) = F(g) . F(f) for all morphisms f:X - Y and g:Y - Z.
Should we write
instance Functor Val where
fmap = undefined
On Dec 15, 2007 12:00 AM, David Menendez [EMAIL PROTECTED] wrote:
These can (and, if Val is a newtype, will) be compiled to the same code, but
they don't have the same type. In particular, there is no way to unify a -
a with f a - f b for any f.
Thanks for noticing that! I hadn't seen before
On 12/14/07, David Menendez [EMAIL PROTECTED] wrote:
And yes, I'm pretty sure that's the only possible implementation for that
type which satisfies the functor laws.
Lets just prove it, then; I'm pretty sure it comes pretty easily from the
free theorem for the type of fmap.
data Val a =
On Dec 15, 2007 3:44 AM, Benja Fallenstein [EMAIL PROTECTED] wrote:
Hmmm. Something about that ticks off my don't play fast and loose
with bottom detector.
I should add that I do think you're correct if you ignore the
existence of bottom, and I'm pretty sure that you're correct if you
allow
On Dec 14, 2007 9:44 PM, Benja Fallenstein [EMAIL PROTECTED]
wrote:
data Val a = Val Int
instance Functor Val where
fmap f (Val x) = f `seq` Val x
Ah, good old seq. How I loathe it.
Seriously, though, good catch. I always forget about seq when I'm doing
stuff like this.
--
Dave
19 matches
Mail list logo