Re: [Haskell-cafe] How to fold on types?

2012-12-25 Thread Timon Gehr
On 12/25/2012 09:59 AM, Magicloud Magiclouds wrote: Say I have things like: data LongDec = LongDef a b c ... x y z values = [ 'a', 'b', 'c', ... 'x', 'y', 'z' ] Now I want them to be LongDef 'a' 'b' 'c' ... 'x' 'y' 'z'. In form, this is something like folding. But since the type changes, so

Re: [Haskell-cafe] Fwd: Object Oriented programming for Functional Programmers

2012-12-30 Thread Timon Gehr
On 12/30/2012 10:57 PM, Eli Frey wrote: sorry, forgot to reply-all -- Forwarded message -- From: *Eli Frey* eli.lee.f...@gmail.com mailto:eli.lee.f...@gmail.com Date: Sun, Dec 30, 2012 at 1:56 PM Subject: Re: [Haskell-cafe] Object Oriented programming for Functional Programmers

Re: [Haskell-cafe] Object Oriented programming for Functional Programmers

2013-01-03 Thread Timon Gehr
On 01/03/2013 10:56 AM, Alberto G. Corona wrote: Anyway, Type checking is essentially an application of set theory : (I did no search in te literature for this, It is just my perception). Not exactly. Type theory is not an application of set theory, it is an alternative to set theory. When

Re: [Haskell-cafe] Object Oriented programming for Functional Programmers

2013-01-03 Thread Timon Gehr
On 01/02/2013 11:19 PM, MigMit wrote: On Jan 3, 2013, at 2:09 AM, Gershom Bazerman gersh...@gmail.com wrote: On 1/2/13 4:29 PM, MigMit wrote: BTW. Why you think that Eiffel type system is unsafe? Well, if I remember correctly, if you call some method of a certain object, and this call

Re: [Haskell-cafe] unsafeInterleaveST (and IO) is really unsafe [was: meaning of referential transparency]

2013-04-11 Thread Timon Gehr
On 04/10/2013 04:45 AM, o...@okmij.org wrote: ... And yet there exists a context that distinguishes x == y from y ==x. That is, there exists bad_ctx :: ((Bool,Bool) - Bool) - Bool such that *R bad_ctx $ \(x,y) - x == y True *R bad_ctx $ \(x,y) - y == x

Re: [Haskell-cafe] unsafeInterleaveST (and IO) is really unsafe

2013-04-12 Thread Timon Gehr
On 04/12/2013 10:24 AM, o...@okmij.org wrote: Timon Gehr wrote: I am not sure that the two statements are equivalent. Above you say that the context distinguishes x == y from y == x and below you say that it distinguishes them in one possible run. I guess this is a terminological problem

Re: [Haskell-cafe] Lambda Calculus question on equivalence

2013-05-02 Thread Timon Gehr
On 05/02/2013 10:42 PM, Francesco Mazzoli wrote: At Thu, 02 May 2013 20:47:07 +0100, Ian Price wrote: I know this isn't perhaps the best forum for this, but maybe you can give me some pointers. Earlier today I was thinking about De Bruijn Indices, and they have the property that two lambda

Re: [Haskell-cafe] Lambda Calculus question on equivalence

2013-05-02 Thread Timon Gehr
On 05/02/2013 11:33 PM, Francesco Mazzoli wrote: At Thu, 02 May 2013 23:16:45 +0200, Timon Gehr wrote: Yes, they can. Take ‘f = λ x : ℕ → x + x’ and ‘g = λ x : ℕ → 2 * x’. Those are not lambda terms. How are they not lambda terms? I guess if + and * are interpreted as syntax sugar

Re: [Haskell-cafe] Lambda Calculus question on equivalence

2013-05-02 Thread Timon Gehr
On 05/02/2013 11:37 PM, Edward Z. Yang wrote: Excerpts from Timon Gehr's message of Thu May 02 14:16:45 -0700 2013: Those are not lambda terms. Furthermore, if those terms are rewritten to operate on church numerals, they have the same unique normal form, namely λλλ 3 2 (3 2 1). The trick is

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Timon Gehr
On 07/11/2013 07:33 PM, Vlatko Basic wrote: Hello Cafe, I have data CmpFunction a = CF (a - a - Bool) that contains comparing functions, like ==, , ..., and I'm trying to declare the Show instance for it like this instance Show (CmpFunction a) where show (CF (==)) = ==

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-16 Thread Timon Gehr
On 07/11/2013 08:37 AM, AntC wrote: oleg at okmij.org writes: ... In Haskell I'll have to uniquely number the s's: let (x,s1) = foo 1 [] in let (y,s2) = bar x s1 in let (z,s3) = baz x y s2 in ... and re-number them if I insert a new statement. I once wrote about

Re: [Haskell-cafe] List Monads and non-determinism

2013-07-19 Thread Timon Gehr
On 07/20/2013 12:23 AM, Matt Ford wrote: Hi All, I thought I'd have a go at destructing [1,2] = \n - [3,4] = \m - return (n,m) which results in [(1,3)(1,4),(2,3),(2,4)] I started by putting brackets in ([1,2] = \n - [3,4]) = \m - return (n,m) ... This is not the same expression any more.

Re: [Haskell-cafe] List Monads and non-determinism

2013-07-19 Thread Timon Gehr
On 07/20/2013 12:58 AM, Matt Ford wrote: Hi, Thanks for the help. I thought = was left associative? It seems to be in the examples from Learn You A Haskell. ... Yes, = is left-associative. The associativity of = is not relevant for your example because no two = operations actually occur

Re: [Haskell-cafe] Alternative name for return

2013-08-07 Thread Timon Gehr
On 08/08/2013 01:19 AM, Jerzy Karczmarczuk wrote: Bardur Arantsson comments the comment of Joe Quinn: On 8/7/2013 11:00 AM, David Thomas wrote: twice :: IO () - IO () twice x = x x I would call that evaluating x twice (incidentally creating two separate evaluations of one pure action

Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Timon Gehr
On 09/10/2013 09:30 AM, Niklas Hambüchen wrote: Impressed by the productivity of my Ruby-writing friends, I have recently come across Cucumber: http://cukes.info It is a great tool for specifying tests and programs in natural language, and especially easy to learn for beginners. I propose

Re: [Haskell-cafe] reifying typeclasses (resend)

2013-09-15 Thread Timon Gehr
On 09/15/2013 09:38 AM, Evan Laforge wrote: ... It seems to me like I should be able to replace a typeclass with arbitrary methods with just two, to reify the type and back. This seems to work when the typeclass dispatches on an argument, but not on a return value. E.g.: ... Say m_argument