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
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
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
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
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
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
($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
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
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