On 7 Mar 2011, at 23:38, Alexander Solla wrote:
_|_ /= (_|_,_|_)
(undefined, undefined)
(*** Exception: Prelude.undefined
That is as close to Haskell-equality as you can get for a proto-value that
does not have an Eq instance. As a consequence of referential transparency,
On Sat, Mar 5, 2011 at 5:06 AM, wren ng thornton w...@freegeek.org wrote:
On 3/4/11 4:33 PM, Alexander Solla wrote:
On Thu, Mar 3, 2011 at 10:14 PM, wren ng thorntonw...@freegeek.org
wrote:
On 3/3/11 2:58 AM, Antti-Juhani Kaijanaho wrote:
On Thu, Mar 03, 2011 at 12:29:44PM +0530,
On Mon, Mar 7, 2011 at 3:38 PM, Alexander Solla alex.so...@gmail.comwrote:
This can be detected by seq: the left-hand side doesn't terminate, whereas
the right-hand side does. And moreover, this can mess up other things (e.g.,
monads) by introducing too much laziness. Space leaks are quite a
On Tuesday 08 March 2011 00:58:36, Alexander Solla wrote:
As a matter of fact, if you read GHC.Prim, you will see that seq is a
bottom!
No, you don't. GHC.Prim is a dummy module whose only purpose is to let
haddock generate documentation. Every function there has the code
let x = x in x,
On 3/7/11 6:38 PM, Alexander Solla wrote:
'seq' is not a function, since it breaks referential transparency and
possibly extensionality in function composition. By construction, seq a b
= b, and yet seq undefined b /= b. Admittedly, the Haskell report and
the GHC implementation, diverge on
On Tuesday 08 March 2011 00:38:53, Alexander Solla wrote:
On Sat, Mar 5, 2011 at 5:06 AM, wren ng thornton w...@freegeek.org
wrote:
If we have,
data OneTuple a = One a
Then
_|_ /= One _|_
That is vacuously true. I will demonstrate the source of the
contradiction
On 3/7/11 6:58 PM, Alexander Solla wrote:
The magic semantics of evaluating the first argument are done by the
compiler/runtime, and are apparently not expressible in Haskell.
Of course this is true. The only ways of forcing evaluation in Haskell
are (a) to perform pattern matches on a value,
On 4/03/2011, at 10:47 PM, Karthick Gururaj wrote:
On Fri, Mar 4, 2011 at 10:42 AM, Richard O'Keefe o...@cs.otago.ac.nz wrote:
On 4/03/2011, at 5:49 PM, Karthick Gururaj wrote:
I meant: there is no reasonable way of ordering tuples, let alone enum
them.
There are several reasonable ways
On Mon, Mar 7, 2011 at 6:12 AM, Richard O'Keefe o...@cs.otago.ac.nz wrote:
On 4/03/2011, at 10:47 PM, Karthick Gururaj wrote:
On Fri, Mar 4, 2011 at 10:42 AM, Richard O'Keefe o...@cs.otago.ac.nz wrote:
On 4/03/2011, at 5:49 PM, Karthick Gururaj wrote:
I meant: there is no reasonable way of
On 7/03/2011, at 5:38 PM, Karthick Gururaj wrote:
Defn 1. Given four arbitrary a, b, c and d on a set X which is an
instance of Ord (so a = b, a b and a b are defined), let:
(a, b) (c, d) iff a c (GT)
(a, b) (c, d) iff a c (LT)
(a, b) = (c, d) iff a = c. (EQ)
(please note that
On 3/4/11 4:33 PM, Alexander Solla wrote:
On Thu, Mar 3, 2011 at 10:14 PM, wren ng thorntonw...@freegeek.org wrote:
On 3/3/11 2:58 AM, Antti-Juhani Kaijanaho wrote:
On Thu, Mar 03, 2011 at 12:29:44PM +0530, Karthick Gururaj wrote:
Thanks - is this the same unit that accompanies IO in IO ()
On Fri, Mar 4, 2011 at 10:42 AM, Richard O'Keefe o...@cs.otago.ac.nz wrote:
On 4/03/2011, at 5:49 PM, Karthick Gururaj wrote:
I meant: there is no reasonable way of ordering tuples, let alone enum
them.
There are several reasonable ways to order tuples.
That does not mean we can't define
On Mar 4, 2011 2:49 AM, Karthick Gururaj karthick.guru...@gmail.com
wrote:
Ord has to be compatible with Eq, and none of these are.
Hmm.. not true. Can you explain what do you mean by compatibility?
Compatibility would mean that x == y if and only if compare x y == EQ. This
is not a
On 4 March 2011 09:47, Karthick Gururaj karthick.guru...@gmail.com wrote:
I'm not able to still appreciate the choice of the default ordering order,
I don't know if this will help you appreciate the default or not, but just
to say this default is concordant with the auto-derived Ord instances.
On Fri, Mar 4, 2011 at 17:37, Chris Smith cdsm...@gmail.com wrote:
The most common use of Ord in real code, to be honest, is to use the value
in some data structure like Data.Set.Set or Data.Map.Map, which requires Ord
instances. For this purpose, any Ord instance that is compatible with Eq
Sorry, I didn't mean to answer you in particular. I meant to say that for
tuples you could (I think) have an enumeration over them without requiring
any component be bounded.
An example of type (Integer, Integer) you would have:
[(0,0) ..] = [(0,0) (0,1) (1,0) (0,2) (1,1) (2,0) ... ]
where the
On Fri, Mar 4, 2011 at 8:45 AM, Markus Läll markus.l...@gmail.com wrote:
Would this also have an uncomputable order type? At least for comparing
tuples you'd just:
You can tell if an enumeration will have an uncomputable order type by
whether or not your enumeration has to count to infinity
On Thu, Mar 3, 2011 at 10:14 PM, wren ng thornton w...@freegeek.org wrote:
On 3/3/11 2:58 AM, Antti-Juhani Kaijanaho wrote:
On Thu, Mar 03, 2011 at 12:29:44PM +0530, Karthick Gururaj wrote:
Thanks - is this the same unit that accompanies IO in IO () ? In
any case, my question is answered
On Friday 04 March 2011 17:45:13, Markus Läll wrote:
Sorry, I didn't mean to answer you in particular. I meant to say that
for tuples you could (I think) have an enumeration over them without
requiring any component be bounded.
Yes, you can (at least mathematically, it may be different if you
On Friday 04 March 2011 22:33:20, Alexander Solla wrote:
Unfortunately, Haskell's tuples aren't quite products.[1]
I'm not seeing this either. (A,B) is certainly the Cartesian product of
A and B.
Not quite in Haskell, there
(A,B) = A×B \union {_|_}
_|_ and (_|_,b) are distinguishable.
Hi,
you can always check the types using GHCi prompt:
*Prelude :i (,)
data (,) a b = (,) a b -- Defined in GHC.Tuple
instance (Bounded a, Bounded b) = Bounded (a, b)
-- Defined in GHC.Enum
instance (Eq a, Eq b) = Eq (a, b) -- Defined in Data.Tuple
instance Functor ((,) a) -- Defined in
On Thu, Mar 3, 2011 at 8:00 PM, Paul Sujkov psuj...@gmail.com wrote:
Hi,
you can always check the types using GHCi prompt:
*Prelude :i (,)
data (,) a b = (,) a b -- Defined in GHC.Tuple
instance (Bounded a, Bounded b) = Bounded (a, b)
-- Defined in GHC.Enum
instance (Eq a, Eq b) = Eq (a,
On Wed, Mar 2, 2011 at 10:09 PM, Karthick Gururaj
karthick.guru...@gmail.com wrote:
Hello,
I'm learning Haskell from the extremely well written (and well
illustrated as well!) tutorial - http://learnyouahaskell.com/chapters.
I have couple of questions from my readings so far.
In
By the way, tuples *can* be members of Enum if you make them so.
Try
instance (Enum a, Enum b, Bounded b) = Enum (a,b)
where
toEnum n = (a, b)
where a = toEnum (n `div` s)
b = toEnum (n `mod` s)
p = fromEnum (minBound `asTypeOf` b)
On Thu, Mar 3, 2011 at 1:58 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote:
I can't think of an approach that doesn't require all but one of
the tuple elements to have Bounded types.
It's not possible. Such an enumeration could potentially have an
uncomputable order-type, possibly equal to
On Thursday 03 March 2011 23:25:48, Alexander Solla wrote:
On Thu, Mar 3, 2011 at 1:58 PM, Richard O'Keefe o...@cs.otago.ac.nz
wrote:
I can't think of an approach that doesn't require all but one of
the tuple elements to have Bounded types.
It's not possible.
Meaning: It's not possible
What about having the order by diagonals, like:
0 1 3
2 4
5
and have none of the pair be bounded?
--
Markus Läll
On 4 Mar 2011, at 01:10, Daniel Fischer daniel.is.fisc...@googlemail.com
wrote:
On Thursday 03 March 2011 23:25:48, Alexander Solla wrote:
On Thu, Mar 3, 2011 at 1:58 PM,
On Friday 04 March 2011 03:24:34, Markus wrote:
What about having the order by diagonals, like:
0 1 3
2 4
5
and have none of the pair be bounded?
I tacitly assumed product order (lexicographic order).
___
Haskell-Cafe mailing list
There are so many responses, that I do not know where to start..
I'm top-posting since that seems best here, let me know if there are
group guidelines against that.
Some clarifications in order on my original post:
a. I ASSUMED that '()' refers to tuples, where we have atleast a pair.
This is
On 4/03/2011, at 5:49 PM, Karthick Gururaj wrote:
I meant: there is no reasonable way of ordering tuples, let alone enum
them.
There are several reasonable ways to order tuples.
That does not mean we can't define them:
1. (a,b) (c,d) if ac
Not really reasonable because it isn't
On 3/3/11 2:58 AM, Antti-Juhani Kaijanaho wrote:
On Thu, Mar 03, 2011 at 12:29:44PM +0530, Karthick Gururaj wrote:
Thanks - is this the same unit that accompanies IO in IO () ? In
any case, my question is answered since it is not a tuple.
It can be viewed as the trivial 0-tuple.
Except that
Hello,
I'm learning Haskell from the extremely well written (and well
illustrated as well!) tutorial - http://learnyouahaskell.com/chapters.
I have couple of questions from my readings so far.
In typeclasses - 101
(http://learnyouahaskell.com/types-and-typeclasses#typeclasses-101),
there is a
On Thu, 2011-03-03 at 11:39 +0530, Karthick Gururaj wrote:
What is the () type? Does it refer to a tuple? How can tuple be
ordered, let alone be enum'd? I tried:
The () type is pronounced unit. It is a type with only 1 value, also
called () and pronounced unit. Since it only has one possible
On Thu, Mar 3, 2011 at 11:48 AM, Chris Smith cdsm...@gmail.com wrote:
On Thu, 2011-03-03 at 11:39 +0530, Karthick Gururaj wrote:
What is the () type? Does it refer to a tuple? How can tuple be
ordered, let alone be enum'd? I tried:
The () type is pronounced unit. It is a type with only 1
On 3 March 2011 17:59, Karthick Gururaj karthick.guru...@gmail.com wrote:
On Thu, Mar 3, 2011 at 11:48 AM, Chris Smith cdsm...@gmail.com wrote:
On Thu, 2011-03-03 at 11:39 +0530, Karthick Gururaj wrote:
What is the () type? Does it refer to a tuple? How can tuple be
ordered, let alone be
On Thu, Mar 03, 2011 at 12:29:44PM +0530, Karthick Gururaj wrote:
Thanks - is this the same unit that accompanies IO in IO () ? In
any case, my question is answered since it is not a tuple.
It can be viewed as the trivial 0-tuple.
--
Antti-Juhani Kaijanaho, Jyväskylä, Finland
36 matches
Mail list logo