Re: lifting functions to tuples?

2003-11-21 Thread Tim Sweeney
In case this is of interest, there is another novel way that a language might support liftTup in full generality. Example code: LiftTup(f:function)(a:f.dom,b:f.dom)={f(a),f(b)} f(x:int)=x+1 LiftTup(f)(3,7) {4,8} LiftTup(caps)(Hello,Goodbye) {HELLO,GOODBYE} Here, the type system supports

Re: Proposal for a new I/O library design

2003-07-28 Thread Tim Sweeney
Ben, I live in a different universe, but over here I prefer to represent files purely as memory-mapped objects. In this view, there is no difference between a read-only file and an immutable array of bytes (a byte being a natural number between 0 to 255). A read-write file is then equivalant to

Re: Typesafe MRef with a regular monad

2003-06-05 Thread Tim Sweeney
Conjecture: It's impossible to implement RefMonad directly in Haskell without making use of built-in ST or IO functionality and without unsafe or potentially diverging code (such as unsafeCoerce). Any takers? If this is true or suspected to be true, any thoughts on whether a structure besides

Re: Safe and sound STRef [Was Implementing RefMonads in Haskell without ST,IO]

2003-06-05 Thread Tim Sweeney
experiment I did a while ago. I was trying to isolate ] the capability of the ST monad to deal with different types at the ] same time I conjecture this functionality cannot be implemented ] in Haskell 98, nor in any of the known safe extensions of Haskell. Recently, Tim Sweeney wrote

Implementing RefMonads in Haskell without ST,IO

2003-05-30 Thread Tim Sweeney
Given the common definition of RefMonad: class Monad m = RefMonad m r | m - r where newRef :: a - m (r a) readRef :: r a - m a writeRef :: r a - a - m () Is it possible to actually implement a working instance of RefMonad in Haskell, without making use of a built-in monad like IO or

Re: Implementing RefMonads in Haskell without ST,IO

2003-05-30 Thread Tim Sweeney
it. But in Haskell, I don't see any way to do this. -Tim - Original Message - From: Derek Elkins [EMAIL PROTECTED] To: Tim Sweeney [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, May 29, 2003 10:31 PM Subject: Re: Implementing RefMonads in Haskell without ST,IO On Thu, 29 May 2003 22

class MonadPlus m = MonadRing m

2003-05-30 Thread Tim Sweeney
($x) -- like map f x let x$=v in e -- like map (\x - e) x -- Monad syntactic sugar: f(%x) -- like x = f let x%=v in e -- like v = \x - e This could be considered a syntactic alternative to the do notation and list comprehension notation. -Tim Sweeney

Re: Tetration operator in functional programming

2000-08-26 Thread Tim Sweeney
It should reflect arithmetic laws of tetration, which for example relate (b ^^ (a1*a2)) with b^^a1 and b^^a2 or so, but are there any? So how should (a,b)--t be defined? I couldn't find any papers on this topic, so I'm trying to work out the laws now. The interesting ones are (a*b)^^c and

Higher-order function application

2000-08-23 Thread Tim Sweeney
In Haskell, only a single notion of "function application" exists, where a function f::t-u is passed a parameter of type t, returning a result of type u. Example function calls are: 1+2 sin 3.14 map sin [1:2:3] However, a higher-order notion of function application seems sensible