On Sun, Oct 01, 2006 at 08:05:15PM -0700, [EMAIL PROTECTED] wrote:
I have come to realize that irrefutable pattern matching of
existentials may indeed be problematic. Let us consider the following
existential data type
data FE = forall a. Typeable a = Foo a
| forall a. Typeable a =
[EMAIL PROTECTED] wrote:
...
So far I never considered it important to devise a concrete syntax for PMC,
but triggered by the current pattern guards thread on haskell-prime,
I now try to give a PMC syntax that blends well with Haskell.
I think with some alterations your syntax would blend
Hi Matthew,
On Windows stdout/stderr/stdin exists only when your application is
using the Console OS subsystem. All GUI applications doesn't have
console window and they don't have stdout/stderr/stdin. When you are
building DLLs then the subsystem is determined from the type of the
application
Hello Matt,
Friday, September 29, 2006, 10:31:10 AM, you wrote:
I would like a non-lazy alternative to
readFile
is there such a thing in the libraries?
i recommend you to use readFile from FPS library. it's strict (unles
you use Lazy module) and then you can either use returned ByteString
Hello tpledger,
Monday, October 2, 2006, 3:11:29 AM, you wrote:
For such a small self-contained task, I don't think Haskell
is any better than Python.
i disagree. while it's hard to beat Python version in number of lines,
Haskell version may have the same length and better performance.
for
[EMAIL PROTECTED] writes:
There is a great temptation to read the following declarations
class Pred a b
instance (Ord b, Eq b) = Pred [Int] b
instance Pred Bool Bool
as a Prolog program:
pred([int],B) - ord(B),eq(B).
pred(bool,bool).
(In
Cheers mate,
That was exactly what I was looking for
matt
On 02/10/2006, at 4:18 PM, Bulat Ziganshin wrote:
Hello Matt,
Friday, September 29, 2006, 10:31:10 AM, you wrote:
I would like a non-lazy alternative to
readFile
is there such a thing in the libraries?
i recommend you to
hi, i don't fully understand your problem, but perhaps you could use
iterate to produce a list or type [Result a], ie, of all computation
steps, and then use this function to extract either result or error
from the list:
type Failmessage = Int
data Result a = Root a | Failure Failmessage
Matthias,
Sorry if I was not clear in stating the problem. Your solution works
nicely, but I would like to try writing a monad. This is what I came
up with:
type Failure = String
data Computation a = Computation (Either Failure a) [a]
instance Monad Computation where
(Computation (Left e)
On Mon, Oct 02, 2006 at 11:35:40AM -0400, Tamas K Papp wrote:
Matthias,
Sorry if I was not clear in stating the problem. Your solution works
nicely, but I would like to try writing a monad. This is what I came
up with:
type Failure = String
data Computation a = Computation (Either
Hi,
I have two lists, p and lambda (both are finite). I would like to
calculate
1) the cumulative sum of lambda, ie if
lambda = [lambda1,lambda2,lambda3,...]
then
csum lambda = [lambda1,lambda1+lambda2,lambda1+lambda2+lambda3,...]
2) the cumulative sum of p*lambda (multiplication
On 10/2/06, Tamas K Papp [EMAIL PROTECTED] wrote:
Hi,
I have two lists, p and lambda (both are finite). I would like to
calculate
1) the cumulative sum of lambda, ie if
lambda = [lambda1,lambda2,lambda3,...]
then
csum lambda = [lambda1,lambda1+lambda2,lambda1+lambda2+lambda3,...]
Try
On Mon, Oct 02, 2006 at 11:42:22AM -0400, Tamas K Papp wrote:
To: haskell-cafe@haskell.org
From: Tamas K Papp [EMAIL PROTECTED]
Date: Mon, 2 Oct 2006 11:42:22 -0400
Subject: Re: [Haskell-cafe] question - which monad to use?
On Mon, Oct 02, 2006 at 11:35:40AM -0400, Tamas K Papp wrote:
Tamas,
try
scanl (+) 0
for the cumulative sum
From there the zipWith idea you mentioned seems like the way to go.
-Chad
Hi,
I have two lists, p and lambda (both are finite). I would like to
calculate
1) the cumulative sum of lambda, ie if
lambda = [lambda1,lambda2,lambda3,...]
then
try
scanl (+) 0
for the cumulative sum
and it is probably worth pointing out once more that (as i have
learned only recently :-) Hoogle can help you even quicker than this
list with questions like these: scanl is the fifth answer if you ask
for a - [a] - [a].
also, the url is easy to
Tamas K Papp wrote:
Hi,
I have a computation where a function is always applied to the
previous result. However, this function may not return a value (it
involves finding a root numerically, and there may be no zero on the
interval). The whole problem has a parameter c0, and the function
Pete Kazmier wrote:
import Data.ByteString.Lazy.Char8 as B hiding (map,foldr)
import Data.List (map)
import Data.Map as M hiding (map)
-- This will be populated from a file
dict = M.singleton (B.pack Pete) (B.pack Kazmier)
main = B.interact $ B.unlines . map doline . B.lines
where
[EMAIL PROTECTED] wrote:
I have come to realize that irrefutable pattern matching of
existentials may indeed be problematic. Let us consider the following
existential data type
data FE = forall a. Typeable a = Foo a
| forall a. Typeable a = Bar a
The following tests type and run
I'm trying to use Data.Time, and I'm totally confused. DiffTime is
abstract, and I don't see anything that maps into it. How do I
construct one? I would like to then use the result to create a value
of type UTCTime, but it seems (currently) like this might be easier.
Thanks,
--
Chad Scherrer
On Sat, Sep 30, 2006 at 01:38:28AM -0700, [EMAIL PROTECTED] wrote:
It seems that irrefutable pattern match with existentials is safe. The
fact that irrefutable pattern match with GADT is unsafe has been
demonstrated back in September 2004.
it is safe in that you can't express coerce, but
Hi All,
I've been [trying to] grapple with the various monads and
transformers, and it occurs to me that the standard instance for
Either as a monadic type is unnecessarily restrictive. Is there a
compelling reason that it is not just
instance Monad (Either e) where
return = Right
(Left
Chad Scherrer wrote:
I'm trying to use Data.Time, and I'm totally confused. DiffTime is
abstract, and I don't see anything that maps into it. How do I
construct one? I would like to then use the result to create a value
of type UTCTime, but it seems (currently) like this might be easier.
It's
Ok, that's much simpler than I was making it. fromIntegral or
fromRational does the trick. Obvious in hindsight, I guess. Thanks!
-Chad
On 10/2/06, Ashley Yakeley [EMAIL PROTECTED] wrote:
Chad Scherrer wrote:
I'm trying to use Data.Time, and I'm totally confused. DiffTime is
abstract, and I
23 matches
Mail list logo