The MaybeT transformer is defined as:
newtype MaybeT m a = MaybeT {runMaybeT :: m (Maybe
http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Maybe
a)}
instance Functor
http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Functor
m = Functor
2008/9/9 Daryoush Mehrtash [EMAIL PROTECTED]:
The MaybeT transformer is defined as:
newtype MaybeT m a = MaybeT {runMaybeT :: m (Maybe a)}
instance Functor m = Functor (MaybeT m) where
fmap f x = MaybeT $ fmap (fmap f) $ runMaybeT x
Question: What does runMaybeT x mean?
If
Thank you for the warm welcome.
About the use of Haskell, it will be for our (urban) rule-based
generation engines (there is a recursive stack of them).
Think about a declarative geographic compiler and you're on the right track.
This engines are not in Haskell right now but it *should* be
2008/9/8 Daryoush Mehrtash [EMAIL PROTECTED]:
The MaybeT transformer is defined as:
newtype MaybeT m a = MaybeT {runMaybeT :: m (Maybe a)}
Question: What does runMaybeT x mean?
This is just shorthand for the following:
newtype MaybeT m a = MaybeT (m (Maybe a))
runMaybeT :: MaybeT m a -
What are you trying to do?
(1) Call a foreign function from inside an STM transaction?
If the function is pure, this is trivial, just declare it as a pure
function in the foreign import statement. You do need to be a bit
careful, however, as it is possible the function will get called with
Hi,
I use Haskell, and my friends at
work use Java. Do you think it
could be a good idea to use Haskell
with Java, so I could understand
and cooperate with them? Is there a
a Haskell to Java compiler that's
already ready to use?
Thanks,
Maurício
___
On Tue, Sep 9, 2008 at 11:36, Jules Bean [EMAIL PROTECTED] wrote:
...not only must it be safe to be called with invalid inputs, but it most
not have any long-term effects, whether the input is valid or invalid, since
I do not believe that there is any way for the function to 'undo' its effect
Arnar Birgisson wrote:
On Tue, Sep 9, 2008 at 11:36, Jules Bean [EMAIL PROTECTED] wrote:
...not only must it be safe to be called with invalid inputs, but it most
not have any long-term effects, whether the input is valid or invalid, since
I do not believe that there is any way for the function
On Tue, Sep 9, 2008 at 11:58, Jules Bean [EMAIL PROTECTED] wrote:
Maybe this is an idea for an extension to the STM system, adding
something like unsafeIOToSTM, except that in addition to the main IO
action, it also takes two more IO actions that are invoked on rollback
and commit,
Hi,
The only thing I can think of is GCJNI:
http://www.haskell.org/gcjni/
This makes use of the FFI and a Greencarded Java JNI interface. It does
allow you to call Java programs from Haskell. However, I'm not sure if it
is still supported.
hth,
Chris.
On Tue, 9 Sep 2008, [ISO-8859-1]
On Mon, Sep 8, 2008 at 8:33 PM, Bruce Eckel [EMAIL PROTECTED] wrote:
As some of you on this list may know, I have struggled to understand
concurrency, on and off for many years, but primarily in the C++ and
Java domains. As time has passed and experience has stacked up, I have
become more
Ryan Ingram wrote:
If the function isn't pure, you need to do a lot more proofs to assure
that this is safe. In particular, the function must be able to be
called with invalid input. If you are confident that this is the
case, you can use unsafeIOToSTM to convert a call to that function
into
I've been playing with this, and on top of STM as it exists, managed
to neatly interleave it with sqite3 and postgres. To do so with
postgres, however, required setting the locking mode to be a bit more
restrictive than it is out-of-the-box. Clever use of encapsulation
and monad
How do folks like to package up QuickCheck tests for their libraries? In
the main library? As a separate repo package? Same repo separate
package? Keeping tests with the tested code allows testing of non-exported
functionality, but can add quite a lot of clutter.
My current leaning is to
On Tue, Sep 9, 2008 at 13:58, Sterling Clover [EMAIL PROTECTED] wrote:
I've been playing with this, and on top of STM as it exists, managed to
neatly interleave it with sqite3 and postgres. To do so with postgres,
however, required setting the locking mode to be a bit more restrictive than
it
It's not haskell to java compiler but you might find cohatoe and
eclipsefp interesting:
http://cohatoe.blogspot.com/
http://eclipsefp.sourceforge.net/
Donnchadh
2008/9/9 Maurício [EMAIL PROTECTED]:
Hi,
I use Haskell, and my friends at
work use Java. Do you think it
could be a good idea
2008/9/9 Conal Elliott [EMAIL PROTECTED]:
How do folks like to package up QuickCheck tests for their libraries? In
the main library? As a separate repo package? Same repo separate
package? Keeping tests with the tested code allows testing of non-exported
functionality, but can add quite
On Tue, Sep 9, 2008 at 2:05 PM, Dougal Stanton [EMAIL PROTECTED] wrote:
If they're in a separate package it's less easy to wire quickcheck
tests into the commit procedure.
And by package there, I mean repo. Obviously ;-)
D
___
Haskell-Cafe mailing
How do folks like to package up QuickCheck tests for their libraries? In
the main library? As a separate repo package? Same repo separate
package? Keeping tests with the tested code allows testing of non-exported
functionality, but can add quite a lot of clutter.
I have QuickCheck
Thanks, Sean.
On Tue, Sep 9, 2008 at 3:46 PM, Sean Leather [EMAIL PROTECTED] wrote:
How do folks like to package up QuickCheck tests for their libraries? In
the main library? As a separate repo package? Same repo separate
package? Keeping tests with the tested code allows testing of
How do folks like to package up QuickCheck tests for their libraries? In
the main library? As a separate repo package? Same repo separate
package? Keeping tests with the tested code allows testing of non-exported
functionality, but can add quite a lot of clutter.
I have QuickCheck
On Wed, Sep 3, 2008 at 10:14 PM, John MacFarlane [EMAIL PROTECTED] wrote:
It would be great if there were an automated or semi-automated way
of generating a MacPorts Portfile from a HackageDB package, along
the lines of dons' cabal2arch. Has anyone been working on such a thing?
And, are any
2008/9/8 Daryoush Mehrtash [EMAIL PROTECTED]
Thanks.
Pattern matching and memory management in Haskell (or may be GHC
implementation of it) is somewhat of a mystery to me. Are there any
references that explains the underlying implementation?
Daryoush
Be careful what you ask for. This
This paper is a bit old but still very relevant:
An External Representation for the GHC Core Language
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.25.1755
Click view or download at the bottom to see the paper. Also, I
haven't used this utility myself yet but it pages and
Hi Sean.
Thanks a bunch for these tips. I haven't used the flags feature of cabal
before, and i don't seem to be able to get it right. I have:
Flag test
Description: Enable testing
Default: False
And I get Warning: unamb.cabal: Unknown section type: flag ignoring
If I indent, I
Conal Elliott [EMAIL PROTECTED] writes:
Thanks a bunch for these tips. I haven't used the flags feature of cabal
before, and i don't seem to be able to get it right.
Another option might be to have the test command build via 'ghc
--make' instead of Cabal - this way, you can avoid mentioning
2008/9/9 Conal Elliott [EMAIL PROTECTED]:
Hi Sean.
Thanks a bunch for these tips. I haven't used the flags feature of cabal
before, and i don't seem to be able to get it right. I have:
Flag test
Description: Enable testing
Default: False
And I get Warning: unamb.cabal: Unknown
Justin Bailey wrote:
This paper is a bit old but still very relevant:
An External Representation for the GHC Core Language
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.25.1755
Click view or download at the bottom to see the paper. Also, I
haven't used this utility myself yet
I rather doubt anybody will know the answer to this, but I'll ask anyway...
Under MS Windows, if you right-click on an executable file and select
properties, sometimes there's a Version tab that tells you the
version number of the program. And sometimes there isn't. (Most
especially,
On Tue, 09 Sep 2008 18:13:50 +0100, you wrote:
Under MS Windows, if you right-click on an executable file and select
properties, sometimes there's a Version tab that tells you the
version number of the program. And sometimes there isn't. (Most
especially, GHC-compiled programs do not have this
Daryoush Mehrtash wrote:
The MaybeT transformer is defined as:
newtype MaybeT m a = MaybeT {runMaybeT :: m (Maybe
http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Maybe
a)}
instance Functor http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Functor m
So this is the kind of problem I keep running into. There will seem to be
consensus that you can do everything with isolated processes message passing
(and note here that I include Actors in this scenario even if their
mechanism is more complex). And then someone will pipe up and say well, of
Steve Schafer wrote:
Version information and application icons are both stored in data
structures called resources; these are appended to the executable
portion of the application, inside the EXE file. There are a number of
predefined resource types, such as the aforementioned version info and
Hi Gwern,
Sorry for not noticing this sooner, my haskell-cafe@ reading is
somewhat behind right now!
After an hour, I came up with a nice clean little script:
import Text.HTML.TagSoup.Render
import Text.HTML.TagSoup
main :: IO ()
main = interact convertPre
convertPre ::
When coding in a POSIX-compliant environment, you can usually write
special escape codes to the console to change the text colour and so
forth. However, this does not work on Windows.
(Ignore all references you see to enabling ANSI.SYS in your config.sys
file; this applies only to 16-bit
On Tue, Sep 9, 2008 at 8:34 AM, Justin Bailey [EMAIL PROTECTED] wrote:
This paper is a bit old but still very relevant:
An External Representation for the GHC Core Language
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.25.1755
Or:
On Tue 2008-09-09 12:30, Bruce Eckel wrote:
So this is the kind of problem I keep running into. There will seem to be
consensus that you can do everything with isolated processes message passing
(and note here that I include Actors in this scenario even if their mechanism
is more complex). And
2008/9/8 Vlad Skvortsov [EMAIL PROTECTED]:
Posting to cafe since I got just one reply on [EMAIL PROTECTED] I was
suggested to
include more SCC annotations, but that didn't help. The 'serialize' function
is still reported to consume about 32% of running time, 29% inherited.
However, functions
On Tue, 2008-09-09 at 20:15 +0100, Andrew Coppin wrote:
When coding in a POSIX-compliant environment, you can usually write
special escape codes to the console to change the text colour and so
forth. However, this does not work on Windows.
(Ignore all references you see to enabling
2008/9/9 Andrew Coppin [EMAIL PROTECTED]:
Actually, now that I think about it, it would be kind of nice to have a
magic package that writes out escape codes or calls the Win32 API depending
on which platform your program is compiled on - in the style of
System.FilePath. I don't know how to do
Hello Andrew,
Tuesday, September 9, 2008, 11:15:08 PM, you wrote:
Haskell. I was not, however, able to find any way at all to import the
symbolic constants necessary, so I was forced to reading through the
source code of the raw C header files to find out what the numeric
values of these
Hello Mauricio,
Tuesday, September 9, 2008, 1:36:09 PM, you wrote:
I use Haskell, and my friends at
work use Java. Do you think it
could be a good idea to use Haskell
with Java, so I could understand
and cooperate with them?
Hello,
I've written a cgi script in haskell, it crashes sometimes with the error
message Prelude . tail : empty list
In Java we would use this approach to log the erro
try {
} catch (Exception e) {
}
--
Pieter Laeremans [EMAIL PROTECTED]
The future is here. It's just not evenly
Woops , I hit the send button to early.
The java approach to locate the error would be
try { ... }catch(Exception e ){
// log error
throw new RuntimeException(e);
}
...
What 's the best equivalent haskell approach ?
thanks in advance,
Pieter
On Tue, Sep 9, 2008 at 10:30 PM, Pieter
This :
Prelude let f = (\x - return something went wrong) :: IOError - IO
String
Prelude let t = return $ show $ too short list !! 100 :: IO String
Prelude catch t f
*** Exception: Prelude.(!!): index too large
doesn't work.
kind regards,
Pieter
On Tue, Sep 9, 2008 at 10:35 PM, Pieter
2008/9/9 Pieter Laeremans [EMAIL PROTECTED]:
What 's the best equivalent haskell approach ?
thanks in advance,
Pieter
The preferred approach is to look at your code, figure out where you
are using tail (or could be calling something that uses tail) and use
the trace function to output logging
Justin Bailey [EMAIL PROTECTED] writes:
are using tail (or could be calling something that uses tail) and use
the trace function to output logging info.
Another cheap trick is to use CPP with something like:
#define head (\xs - case xs of { (x:_) - x ; _ - error(head failed at
Or define your own ghead and gtail:
ghead msg [] = error ghead ++ msg ++ []
ghead _ (x:xs) = x
gtail msg [] = error gtail ++ msg ++ []
gtail msg (x:xs) = xs
and you can call them with a name of a function to give you an idea where
the error is occurring:
myHead = ghead myHead []
Chris.
On Tue, Sep 09, 2008 at 11:06:43PM +0200, Pieter Laeremans wrote:
This :
Prelude let f = (\x - return something went wrong) :: IOError - IO
String
Prelude let t = return $ show $ too short list !! 100 :: IO String
Prelude catch t f
*** Exception: Prelude.(!!): index too large
How about:
Thanks a bunch for these tips. I haven't used the flags feature of cabal
before, and i don't seem to be able to get it right.
This is also my first time, so I'm not sure exactly what I'm doing right. ;)
I have:
Flag test
Description: Enable testing
Default: False
And I get
Today i wrote some sample code after a Logic lecture at my university.
The idea is to represent the AST of propositional logic as an ADT with
some convenience functions (like read-/show instances) and then later
perhaps try to make some automatic transformations on the AST.
After construction of
On Wed, 2008-09-10 at 00:01 +0200, Mattias Bengtsson wrote:
[..]
What happens can be seen in the attached picture[..]
And here it is...
attachment: Screenshot-Terminal2.jpg
signature.asc
Description: This is a digitally signed message part
___
My tests are making use of a nice console test runner I wrote that
supports both HUnit and QuickCheck (and is extensible to other test
providers by the user):
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/test-framework.
The description looks great! I might have to try it out.
On 10 Sep 2008, at 00:01, Mattias Bengtsson wrote:
Today i wrote some sample code after a Logic lecture at my university.
The idea is to represent the AST of propositional logic as an ADT with
some convenience functions (like read-/show instances) and then later
perhaps try to make some
On Wed, 2008-09-10 at 00:07 +0200, Thomas Davie wrote:
import Prelude hiding (print)
import System.IO.UTF8
main = print lots of UTF8
Thanks a lot!
signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Andrew Coppin wrote:
(Ignore all references you see to enabling ANSI.SYS in your config.sys
file; this applies only to 16-bit MS-DOS programs, *not* to 32-bit
Windows programs.)
You can add interpretation of ansi escape sequences to any win32
program by launching the application through
Justin Bailey on 2008-09-09 14:12:38 -0700:
2008/9/9 Pieter Laeremans [EMAIL PROTECTED]:
What 's the best equivalent haskell approach ?
thanks in advance,
Pieter
The preferred approach is to look at your code, figure out where you
are using tail (or could be calling something that uses
Justin Bailey wrote:
2008/9/9 Pieter Laeremans [EMAIL PROTECTED]:
What 's the best equivalent haskell approach ?
thanks in advance,
Pieter
The preferred approach is to look at your code, figure out where you
are using tail (or could be calling something that uses tail) and use
the trace
This :
Prelude let f = (\x - return something went wrong) :: IOError - IO
String
Prelude let t = return $ show $ too short list !! 100 :: IO String
Prelude catch t f
*** Exception: Prelude.(!!): index too large
doesn't work.
You might be interested in the difference between
I've discussed the license of data-accessor with it's authors (Luke
Palmer Henning Thieleman). They are ok with changing it to BSD3. So I
don't think the license will be a reason not to use it.
Tim
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ganesh
2008/9/9 Conal Elliott [EMAIL PROTECTED]:
Where do you like to place your tests? In the functionality modules? A
parallel structure? A single Test.hs file somewhere?
The last time I had a chance to experiment with how to do this I used
a single Test.hs for the whole project and I think that
Bruce Eckel [EMAIL PROTECTED] wrote:
...shared-memory concurrency is impossible for programmers to
get right...
Explicit locking is impractical to get right. Transactional
interfaces take much of the pain out of that -- even web
monkeys can get shared memory right with SQL!
When two
Why do you want to mix haskall and Java in one VM? If there are
functionality within your code that is better implemented in haskell, then
why not make that into a service (run it as haskell) with some api that
Java code can use.
Daryoush
On Tue, Sep 9, 2008 at 2:36 AM, Maurício [EMAIL
On Mon, 2008-09-08 at 16:26 -0700, Iavor Diatchki wrote:
Hi,
I just noticed that hackage has introduced a new policy to disallow
changes to a package without bumping the version. I understand that
this is probably a good idea for changes to the source code, but it
really would be nice to
2008/9/9 Sean Leather [EMAIL PROTECTED]:
My tests are making use of a nice console test runner I wrote that
supports both HUnit and QuickCheck (and is extensible to other test
providers by the user):
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/test-framework.
The description
Justin Bailey wrote:
2008/9/8 Daryoush Mehrtash [EMAIL PROTECTED]
Thanks.
Pattern matching and memory management in Haskell (or may be GHC
implementation of it) is somewhat of a mystery to me. Are there
any references that explains the underlying implementation?
Be careful what you ask
Daryoush Mehrtash wrote:
The MaybeT transformer is defined as:
newtype MaybeT m a = MaybeT {runMaybeT :: m (Maybe a)}
Question: What does runMaybeT x mean?
As for what does it do, I think everyone else has handled that pretty
well. As far as what does it mean, it may help to think
Maurício wrote:
Hi,
I use Haskell, and my friends at
work use Java. Do you think it
could be a good idea to use Haskell
with Java, so I could understand
and cooperate with them? Is there a
a Haskell to Java compiler that's
already ready to use?
Generally speaking, not really. There was a lot
Pieter Laeremans wrote:
This :
Prelude let f = (\x - return something went wrong) :: IOError - IO
String
Prelude let t = return $ show $ too short list !! 100 :: IO String
Prelude catch t f
*** Exception: Prelude.(!!): index too large
doesn't work.
As others've said, the right answer is
Jason Dagit wrote:
On the other hand, specifying tests was
as simple as starting a function name with prop_ [...]
which of course reminds us of JUnit of the dark ages (up to 3.8),
before they finally used annotations to declare test cases.
Has there ever been a discussion of typed,
70 matches
Mail list logo