2008/6/30 Joachim Breitner [EMAIL PROTECTED]:
The problem I stumbled over was that considering the type of =
(=): Monad m = m a - (a - m b) - m b
means that I can not „look ahead what files would be written without
actually reading the requested file. Of course this is not always
possible,
On Tue, Jun 24, 2008 at 6:34 PM, Norbert Wojtowicz
[EMAIL PROTECTED] wrote:
Attached is a patched version of SDL_mixer 0.5.2 with a C wrapper
for this macro. I'm now able to run loadWAV in ghci.
Works for me, thanks!
Now I just need to learn how to make my WAVs sound not like
On Mon, Jun 23, 2008 at 5:58 AM, Luke Palmer [EMAIL PROTECTED] wrote:
On Mon, Jun 23, 2008 at 3:26 AM, Xiao-Yong Jin [EMAIL PROTECTED] wrote:
Hi all,
I'm writing a short function as follows, but I'm not able to
find a suitable type signature for `go'. It uses
Numeric.LinearAlgebra from
On Mon, Jun 23, 2008 at 6:50 AM, Harald ROTTER [EMAIL PROTECTED] wrote:
Hello,
sorry for the late answer, I was off for the weekend :-)
The paper Number-parameterized types by Oleg Kielyov is located at
http://okmij.org/ftp/papers/number-parameterized-types.pdf
It impressively shows
On Mon, Jun 23, 2008 at 6:30 AM, leledumbo [EMAIL PROTECTED] wrote:
I've successfully create a function to return lists of N-ple that satisfy the
following function:
x1 + x2 + x3 + ... + xN = C
But unfortunately, it's not generic. The N is supposed to be an input, too.
I don't know how to
On Mon, Jun 23, 2008 at 3:26 AM, Xiao-Yong Jin [EMAIL PROTECTED] wrote:
Hi all,
I'm writing a short function as follows, but I'm not able to
find a suitable type signature for `go'. It uses
Numeric.LinearAlgebra from hmatrix.
-- | Map each element in a vector to vectors and thus form a
On Sat, Jun 21, 2008 at 7:11 PM, Brent Yorgey [EMAIL PROTECTED] wrote:
First, given finite sets A (representing an 'alphabet') and S
(representing 'states'), we can describe a finite state machine by a
function phi : A x S - S, which gives 'transition rules' giving a new
state for each
On Tue, Jun 17, 2008 at 2:40 PM, Ron Alford [EMAIL PROTECTED] wrote:
I'm trying to wrap my head around the theoretical aspects of haskell's
type system. Is there a discussion of the topic separate from the
language itself?
Since I come from a rather logic-y background, I have this
On Wed, Jun 18, 2008 at 1:42 PM, PR Stanley [EMAIL PROTECTED] wrote:
Now, if you, Jules, Alex or some other wannabe Hitler have a problem with
my freedom of expression then your best solution is to saddle up and get the
hell out yourselves. This is the wrong place for setting up your tinpot
On Tue, Jun 17, 2008 at 4:45 PM, Karoly Negyesi [EMAIL PROTECTED] wrote:
Hi,
The PHP community is discussing the adding of closures and lambdas to
the language, see the proposal at http://wiki.php.net/rfc/closures
If someone with knowledge of both languages could take a quick look it
would
On Sat, Jun 7, 2008 at 5:07 PM, Dmitri O.Kondratiev [EMAIL PROTECTED] wrote:
{--
And what does the word newbie imply to you when answering my question?
In what case using 'fundeps' and 'associated types' will make sence for this
example?
--}
Well, functional dependencies (fundeps) and
2008/6/8 Galchin, Vasili [EMAIL PROTECTED]:
Hello,
I am getting what is to me a mysterious error in a test case that I am
writing:
[EMAIL PROTECTED]:~/FTP/Haskell/unix-2.2.0.0/tests/timer$ runhaskell
Setup.lhs build
Preprocessing executables for Test-1.0...
Building Test-1.0...
[1 of
On Fri, Jun 6, 2008 at 4:41 PM, Klaus Ostermann [EMAIL PROTECTED] wrote:
type Id a = a
x :: Id Int
x = undefined
y :: (a Int) - (a Int)
y = undefined
In a Int, a refers to any type constructor, not any type function.
So the best you can do is:
newtype Id a = Id a
-- rest as before
Luke
2008/6/7 Dmitri O.Kondratiev [EMAIL PROTECTED]:
class Store s where
put :: Eq k = (k, v) - s - s
get :: k s - Maybe v
I suspect you want this to be a constructor class. That is, you want
to make explicit the fact that the type s depends on k and v.
class Store s where
put :: Eq
On Sat, Jun 7, 2008 at 1:08 PM, Luke Palmer [EMAIL PROTECTED] wrote:
2008/6/7 Dmitri O.Kondratiev [EMAIL PROTECTED]:
class Store s where
put :: Eq k = (k, v) - s - s
get :: k s - Maybe v
I suspect you want this to be a constructor class. That is, you want
to make explicit the fact
On Wed, Jun 4, 2008 at 9:48 AM, Loup Vaillant [EMAIL PROTECTED] wrote:
I see a problem with this particular fusion, though: It changes the
space complexity of the program, from linear to constant. Therefore,
with some programs, relying on this optimization can be a matter of
correctness, not
On Tue, Jun 3, 2008 at 6:48 PM, Ronald Guida [EMAIL PROTECTED] wrote:
filter (\x - case x of A - True; otherwise - False) sampleTypes
== [A]
filter (\x - case x of B _ - True; otherwise - False) sampleTypes
== [B 5]
There's a neat little mini-trick for these types of pattern matches:
On Thu, May 29, 2008 at 9:51 AM, Kim-Ee Yeoh [EMAIL PROTECTED] wrote:
Roberto Zunino-2 wrote:
Alas, for code like yours:
foo = \f - (f 'J', f True)
there are infinite valid types too:
(forall a. a - Int) - (Int, Int)
(forall a. a - Char)- (Char, Char)
(forall a. a - (a,a)) -
On Tue, May 27, 2008 at 5:55 PM, Andrew Coppin
[EMAIL PROTECTED] wrote:
Gleb Alexeyev wrote:
foo :: (forall a . a - a) - (Bool, String)
foo g = (g True, g bzzt)
So, after an entire day of boggling my mind over this, I have brought it
down to one simple example:
(id 'J', id True) --
On Fri, May 23, 2008 at 10:55 AM, Jules Bean [EMAIL PROTECTED] wrote:
Krasimir Angelov wrote:
The monads design is used in Data.Map i.e.
lookup :: (Monad m, Ord k) = k - Map k a - m a
which is widely considered a poor design decision and a wart on Data.Map.
It is? Can you point to
Hi Dmitri. I'm just going to ramble on about what I know and how I
think of things, and maybe you'll pick something up :-)
On 5/19/08, Dmitri O.Kondratiev [EMAIL PROTECTED] wrote:
getAny :: (Random a) = State StdGen a
getAny = do g - get
(x,g') - return $ random g
On Sat, May 17, 2008 at 11:45 PM, Jeroen [EMAIL PROTECTED] wrote:
I only tested with -O2 and my primes implementation
is the Sieve of Eratosthenes and has signature
primes :: Integral a = [a]
I'm guessing that you already know this, but this declares that primes
should *not* be cached
2008/5/17 Kaveh Shahbazian [EMAIL PROTECTED]:
3 - What is the logical implementation of pattern matching in C#? (For
example using structures with indicator fields or using interfaces and
inheritance and dynamically dispatch in calling overloaded methods. Also
this question contain a hidden
2008/5/18 Peter Verswyvelen [EMAIL PROTECTED]:
In Haskell, I sometimes have to annotate code with type info because the
type-inferer otherwise fails (even with -XNoMonomorphismRestriction).
Surely, most of the time this is because I was writing buggy code, but
sometimes, type annotation just
On Mon, May 19, 2008 at 2:02 AM, john lask [EMAIL PROTECTED] wrote:
Consider the data type:
Foo i o a = ...
we want to declare an instance of Monad and Arrow for Foo without using a
newtype (repackaging).
The effect we want is to be able to construct an expression like:
( f g ) ( h i
On Sat, May 17, 2008 at 5:22 PM, Philip Müller
[EMAIL PROTECTED] wrote:
If someone here finds the time to look at my code and give me some hints,
that would really be nice.
A little experimentation reveals that your main bottleneck is readCSVLine:
readCSVLine = read . (\x - [ ++ x ++ ])
(I
On Thu, May 15, 2008 at 8:45 PM, Andrew Coppin
[EMAIL PROTECTED] wrote:
Yitzchak Gale wrote:
And of course, you wouldn't want that:
f xs = xs : map expensiveCalculation xs
Please don't fuse those two loops into one.
...doesn't type check. Did you mean (++)?
Hmm? While the name might
On Fri, May 9, 2008 at 3:46 PM, Achim Schneider [EMAIL PROTECTED] wrote:
Miguel Mitrofanov [EMAIL PROTECTED] wrote:
Oh, you sure?
I was, until you wrote that. But then, I am, as I wouldn't use
unsafePerformIO together with IORef's, it's giving me the creeps.
So.. what do you use
On Thu, May 8, 2008 at 5:09 PM, Philip Müller [EMAIL PROTECTED] wrote:
Thanks for all the answers. I'm testing this right now and simples cases
work as expected. However from what I've read it seems it'll get ugly once I
try to pass a C array to a Haskell function.
Well, maybe arrays in C
On Wed, May 7, 2008 at 9:27 PM, PR Stanley [EMAIL PROTECTED] wrote:
Hi
One of you chaps mentioned the Nat data type
data Nat = Zero | Succ Nat
Let's have
add :: Nat - Nat - Nat
add Zero n = n
add (Succ m)n = Succ (add m n)
Prove
add m Zero = m
To prove this by induction on m,
On Tue, May 6, 2008 at 4:53 AM, Achim Schneider [EMAIL PROTECTED] wrote:
PR Stanley [EMAIL PROTECTED] wrote:
Hi
I don't know what it is that I'm not getting where mathematical
induction is concerned. This is relevant to Haskell so I wonder if
any of you gents could explain in
After you grok induction over the naturals, you can start to think
about structural induction, which is usually what we use in
programming. They are related, and understanding one will help you
understand the other (structural induction actually made more sense to
me when I was learning, because
SDL-image
(http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SDL-image-0.5.2)
also supports this.
Luke
On Sun, May 4, 2008 at 12:12 AM, Nahuel Rullo [EMAIL PROTECTED] wrote:
Hi list, i am new in Haskell. I need to make images (PNG, JPEG) with
haskell, if you can give me a tutorial,
2008/5/4 Ivan Amarquaye [EMAIL PROTECTED]:
Hi everyone,
this is my first posting on here and this was what drove me here and the
quest to know more as i anticipate a lot of help and direction in this quite
new and different environment haskell.I have this paper that i'm working on
and need
2008/5/2 Galchin, Vasili [EMAIL PROTECTED]:
data Bozo =
Bozo {
id :: Int
}
bonzo :: Maybe Bozo - IO ()
bonzo maybe_bozo = do
if maybe_bozo == (Just (Bozo x))
then
return ()
else
return ()
bonzo maybe_bozo =
case maybe_bozo of
On Tue, Apr 29, 2008 at 8:54 AM, rodrigo.bonifacio
[EMAIL PROTECTED] wrote:
Hi all,
I have the following data types:
type Id = String
type Action = String
type State = String
type Response = String
data Scenario = Scenario Description [Step]
data Step = Step Id Scenario Action
2008/4/28 Fraser Wilson [EMAIL PROTECTED]:
On Mon, Apr 28, 2008 at 10:50 PM, Brandon S. Allbery KF8NH
[EMAIL PROTECTED] wrote:
The format is instance [context =] classname instance.
Your classname is ValueClass.
Your instance is a. a is not of the form (T a1 ... an).
But neither is
2008/4/28 Fraser Wilson [EMAIL PROTECTED]:
what I am trying to say is if a is an instance of Num, then
can be an instance of ValueClass too, and here's how.
Oh, didn't answer this one. This is almost canned response, questions
like this get asked weekly on this list.
Short answer: you can't.
On Mon, Apr 28, 2008 at 3:47 PM, Fraser Wilson [EMAIL PROTECTED] wrote:
On Mon, Apr 28, 2008 at 11:33 PM, Luke Palmer [EMAIL PROTECTED] wrote:
To answer your other question, no, there is no list show hack.
Perhaps hack was a strong word. I'm not referring to type synonyms, but to
the fact
2008/4/28 cetin tozkoparan [EMAIL PROTECTED]:
Assume a tree is a subtree of the other if all elements of the first tree
is included in the second with the exact structure; all parent-child
relations are preserved with their order.
data Tree = Empty | Leaf Int | Node (Int,Tree,Tree)
Bit of a
On Tue, Apr 22, 2008 at 11:32 AM, Ben [EMAIL PROTECTED] wrote:
Hello Haskellers,
I'm running ghc 6.8.2 on vista 64. Consider the following program,
which is compiled with -02 -prof -auto-all:
module Main where
import System.IO (openFile, IOMode(..), hPutStr)
testlst = let ls = [(i,
On Tue, Apr 22, 2008 at 6:26 AM, Henning Thielemann
[EMAIL PROTECTED] wrote:
On Mon, 21 Apr 2008, Ryan Ingram wrote:
I recommend this blog entry:
http://twan.home.fmf.nl/blog/haskell/overloading-functional-references.details
along with a few additional combinators for imperative update:
On Thu, Apr 24, 2008 at 11:28 PM, Ben [EMAIL PROTECTED] wrote:
2) Is there a reason to not use mapM3 above?
Yes, there certainly is. mapM3 is not equivalent to mapM; it is too strict:
*Main take 3 $ head $ mapM return [1,2,3,4,undefined]
[1,2,3]
*Main take 3 $ head $ mapM3 return
On Thu, Apr 24, 2008 at 11:10 PM, Ryan Ingram [EMAIL PROTECTED] wrote:
More FRP stuff: a new type for Future that came to me in an
inspiration this morning. But it's ugly and I need someone with
better theoretical underpinnings than me to tell me what I've really
built :)
data Future t
On Fri, Apr 25, 2008 at 12:02 AM, Ben [EMAIL PROTECTED] wrote:
Luke,
Thanks for the nice answer. So maybe I'll give mapM3 the name mapM'
and put it in my personal library.
Except the answer was wrong. I forgot the reverse in my
implementation, so that undefined we were seeing was just the
On Tue, Apr 15, 2008 at 3:45 AM, Benjamin L. Russell
[EMAIL PROTECTED] wrote:
hanoi_shower ((a, b) : moves)
| null moves = Move ++ show a ++ to ++ show
b ++ .
| otherwise == Move ++ show a ++ to ++ show
b ++ . ++ hanoi_shower moves
More idiomatic pedantry: the way you will see
2008/4/11 Conal Elliott [EMAIL PROTECTED]:
I'm trying to install the SDL package (on win32+cygwin), and configure isn't
able to find my SDL.dll, though it's on my PATH. Any ideas? - Conal
bash-3.2$ cabal install SDL
'SDL-0.5.3' is cached.
[1 of 1] Compiling Main ( Setup.lhs,
On Thu, Apr 10, 2008 at 2:50 PM, Adam Smyczek [EMAIL PROTECTED] wrote:
For a small webapi binding I try to implement a session like monad
by building a stack including BrowserAction from Network.Browser
module as following:
newtype RBAction a = RBAction
{ exec :: ErrorT String (StateT
On Thu, Apr 10, 2008 at 2:05 AM, Jackm139 [EMAIL PROTECTED] wrote:
I'm trying to write a function to recognize a context free grammar, but I
keep getting pattern match failure errors. This is what I have:
data Grammar c = Brule c c c | Rule c c
gez = [(Brule 'S' 'p' 'D'),(Brule 'D' 't'
graphics-drawingcombinators 0.1 has just been uploaded to hackage:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/graphics-drawingcombinators-0.1
Have you ever tried to write a simple 2D interface or game but found:
* wxHaskell and gtk2hs are hard to install and learn
* SDL does
On Sat, Apr 5, 2008 at 4:00 PM, Cale Gibbard [EMAIL PROTECTED] wrote:
GHC has a special syntax for using ArrowApply (which HXT is an
instance of). Whenever the expression to the left of - needs to
involve a local variable, you can replace - with - and it should
work. To understand better
On Thu, Apr 3, 2008 at 9:58 AM, Ben Lippmeier [EMAIL PROTECTED] wrote:
Hi all,
I have some quick questions for the type theory people:
If I write an expression:
(if .. then 23 else Erk)
In Haskell this would be an error, but perhaps I can assign it the type
'Top' (or 'Any') and then
2008/4/2 porrifolius [EMAIL PROTECTED]:
(7) ideally required permissions would appear (and accumulate) in type
signatures via inference so application code knows which are required and
type checker can reject static/dynamic role constraint violations
If you mean what I think you mean by
On Mon, Mar 31, 2008 at 6:00 PM, Bruno Carnazzi [EMAIL PROTECTED] wrote:
I've done this modification with no more success :
import qualified Data.List as List
import qualified Data.Map as Map
f :: Integer - Integer
f n | even n = n `div` 2
| otherwise = 3 * n + 1
chain m n =
On Fri, Mar 28, 2008 at 6:28 AM, Jim Snow [EMAIL PROTECTED] wrote:
I was trying to get Blinn highlights working with my raytracer, and kept
getting ugly artifacts. After trying a bunch of things, I finally
compiled without -O2, and the artifacts went away.
Here's what I mean:
On Thu, Mar 27, 2008 at 2:18 PM, Claude Heiland-Allen
The combination of (-+) and h is too strict, this modification works:
(-+) :: a - List a - List a
x -+ ~(List y) = List(f) where -- lazy pattern match
f 0 = x
f k = y(k-1)
More to the point, if List is declared as:
Hi Paul,
2008/3/27 Paul Keir [EMAIL PROTECTED]:
Hi,
Does anyone know why this reduced Parsec production stops compilation, and
how I can fix it?
tester = reserved parameter
| do { reserved dimension; symbol : }
Look at the types of reserved and symbol (from
On Tue, Mar 25, 2008 at 7:37 PM, Paul L [EMAIL PROTECTED] wrote:
Peter is right at saying it's the sample GLFW program that didn't
handle Window Close event. I didn't double check his modification
because I run Linux/X11 with xmonad where there is no CLOSE button for
any window, but I trust
Er, not Ctrl, of course... Mod-Shift-C. /me goes to punish his hand
for compusive send presses.
On Tue, Mar 25, 2008 at 10:40 PM, Luke Palmer [EMAIL PROTECTED] wrote:
On Tue, Mar 25, 2008 at 7:37 PM, Paul L [EMAIL PROTECTED] wrote:
Peter is right at saying it's the sample GLFW program
First I'd like to say that this is a very clever idea. Thanks for the
exposition. :-)
2008/3/21 Krzysztof Skrzętnicki [EMAIL PROTECTED]:
I'd like to write the following code:
instance (Ord a) = YOrd a where
ycmp x y = case x `compare` y of
LT - (x,y)
On Tue, Mar 18, 2008 at 12:24 PM, iliali16 [EMAIL PROTECTED] wrote:
Now the problem comes here:
play (p1 :: p2) state
|play p1 state == (i1,state1) play p2 state1 == (i2,state2)
= (i1+++i2,state2)
I know that if I manage to do that function the one above with this sign ::
On Wed, Mar 12, 2008 at 4:45 PM, Donn Cave [EMAIL PROTECTED] wrote:
Well, the problem inherently requires a certain order of
evaluation. But if you will just handle pattern match failure
in the IO monad, then you can write a simple functional
expression of the problem instead,
let
On Thu, Mar 13, 2008 at 1:00 AM, Adrian Hey [EMAIL PROTECTED] wrote:
AFAICT the report is ambiguous about this, or at least the non-intutive
equality semantics are not at all clear to me from what I can see in
the Eq class definition (para 6.3.1). I think an the absence of any
clear and
On Thu, Mar 13, 2008 at 3:02 AM, Adrian Hey [EMAIL PROTECTED] wrote:
The report doesn't state that for all Ints, (x==y = True) implies that
x=y. There's no reason to suppose the Int instance is in any way
special, so do you really seriously consider the possibility that
this might not hold
On Mon, Mar 10, 2008 at 7:37 AM, Donn Cave [EMAIL PROTECTED] wrote:
On Mar 9, 2008, at 1:07 PM, Henning Thielemann wrote:
Errors are programming errors and must be fixed as Denis explained.
Thus
there is no need for a complex system of handling these situations at
run-time. The
On Mon, Mar 10, 2008 at 11:00 AM, Adrian Hey [EMAIL PROTECTED] wrote:
Neil Mitchell wrote:
2) What does it do with duplicate elements in the list? I expect it
deletes
them. To avoid this, you'd need to use something like fromListWith,
keeping
track of how many duplicates there
2008/3/10 Krzysztof Skrzętnicki [EMAIL PROTECTED]:
In Python the syntax to create 1-tuple is (element,). Note the ,. It's not
the most beautiful but is acceptable.
But that syntax ought to be for tuple sections. Is there a good
reason that Haskell doesn't have tuple sections?
(hello, world)
On Sun, Mar 9, 2008 at 3:21 AM, Thomas Hartman [EMAIL PROTECTED] wrote:
instance (Enum a, Bounded a) = Arbitrary a where
arbitrary = do n - choose (fromEnum (minBound :: a), fromEnum
(maxBound :: a) )
return $ toEnum n
I really think it's a bad idea to allow undecidable
On Sun, Mar 9, 2008 at 3:23 AM, Brandon S. Allbery KF8NH
[EMAIL PROTECTED] wrote:
myFunc :: (forall a. (Bounded a, Enum a) = a) -
(forall a. (Bounded a, Enum a) = a) -
(forall a. (Bounded a, Enum a) = a)
which is a rather useless declaration (I think the only
On Thu, Mar 6, 2008 at 7:52 PM, Ryan Ingram [EMAIL PROTECTED] wrote:
I wish there was some form of instance declaration that let you do
case analysis; something similar to the following:
instances C [a] where
instance C String where
c = a
instance C a = C [a] where
On Tue, Mar 4, 2008 at 4:16 AM, Ketil Malde [EMAIL PROTECTED] wrote:
Paul Johnson [EMAIL PROTECTED] writes:
I'm surprised you found the significant whitespace difficult.
I wonder if this has something to do with the editor one uses? I use
Emacs, and just keep hitting TAB, cycling
2008/3/2 Roman Cheplyaka [EMAIL PROTECTED]:
* Krzysztof Skrzętnicki [EMAIL PROTECTED] [2008-03-02 01:21:42+0100]
Well, it is simply
coerce :: a - b
coerce _ = undefined
so coerce is simply empty function. But still, it is possible to write a
function of type (a-b).
Well,
On Mon, Mar 3, 2008 at 2:23 AM, Krzysztof Kościuszkiewicz
[EMAIL PROTECTED] wrote:
Dear Haskellers,
Another story from an (almost) happy Haskell user that finds himself
overwhelmed by laziness/space leaks.
I'm trying to parse a large file (600MB) with a single S-expression
like
On Sat, Mar 1, 2008 at 8:18 AM, Milos Hasan [EMAIL PROTECTED] wrote:
Here's a minimal summing example that illustrates the difference. The
following works fine, since the elements are generated lazily and summed
on the fly, as expected:
randFloats :: [Float]
randFloats = randoms
On Sat, Mar 1, 2008 at 6:50 AM, Milos Hasan [EMAIL PROTECTED] wrote:
Hi,
so let's say I want to generate a list of N random floats. The elegant
way of doing it would be to create an infinite lazy list of floats and
take the first N, but for N = 1,000,000 or more, this overflows the
On Thu, Feb 28, 2008 at 7:28 AM, Aaron Altman [EMAIL PROTECTED] wrote:
newtype CircularFuncList funcList arg = CircularFuncList (funcList -
arg - (arg, funcList))
instance Monad (CircularFuncList funcList arg) where
return a = CircularFuncList (\funcList a - (a, funcList))
On Feb 18, 2008 5:11 AM, Stuart Cook [EMAIL PROTECTED] wrote:
A while ago I wrote a little data structure that allows weighted
random selection-without-replacement from a collection of values in
O(log n) time.[1] I'm now in the process of packaging it up for
Hackage, but I'm looking for good
On Feb 18, 2008 12:20 AM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:
On Feb 17, 2008, at 19:13 , Jefferson Heard wrote:
In C and in Java, I can use truetype fonts in Haskell using select
libraries, and I'd like to be able to do the same in Haskell. Are
there any portable libraries
On Feb 17, 2008 6:20 AM, PR Stanley [EMAIL PROTECTED] wrote:
I can't think of an elegant pattern for the last function. I've
already tried set comprehension. However, something tells me that the
answer may lie in a complex recursive pattern. I'm not afraid of
complex solutions but I
On Thu, Feb 14, 2008 at 12:50 AM, Steve Lihn [EMAIL PROTECTED] wrote:
He described a few things that cannot be represented as a monad, they are:
1. Stream
This is actually a comonad.
2. FRP
Depends on which FRP you're talking about. This could be the stream
comonoad + the event monad.
On Thu, Feb 14, 2008 at 7:34 PM, Steve Lihn [EMAIL PROTECTED] wrote:
I have a small question on the simulation technique. In both John
Hughes and your code, you wrap the print inside the runXYZ (...) to
print out the state of simulation. It is like:
runArrow ( ... simulation ...then print
On Feb 13, 2008 9:33 AM, [EMAIL PROTECTED] wrote:
The approach is based on the final tagless representation. Here is our
DSL:
class Exp repr where
constant :: Int - repr Int
variable :: String - repr Int
add :: repr Int - repr Int - repr Int
sub :: repr Int - repr Int -
2008/2/12 Uwe Hollerbach [EMAIL PROTECTED]:
Well... I dunno. Looking at the source to GHC.Real, I see
infinity, notANumber :: Rational
infinity = 1 :% 0
notANumber = 0 :% 0
This is actually the reason I imported GHC.Real, because just plain %
normalizes the rational number it creates,
On Feb 12, 2008 6:28 PM, John Lato [EMAIL PROTECTED] wrote:
Hello,
I was recently looking at the STM library, and I have a question about
the function unsafeIOToSTM. Can anyone explain to me what is unsafe
about it, and what sort of use would be considered safe?
A few things. First, this
On Feb 11, 2008 2:27 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hallo!
I have this code:
q1 :: EName - [ApprenticeInfo]
q1 c = [apprenticeInfo n | n - allApprentices, member ((sq4
c) (firstOf5(n))) == True]
sq4 :: ESurname - [IDB]
sq4 c = (sq3
Quite frequently.
Here are a few examples from my own code:
For functional references (representing a bidirectional function
from a data type to a part of itself (for example the first element of
a pair)).
data Accessor s a
= Accessor { get :: s - a
, set :: a - s - s
On Feb 6, 2008 11:32 AM, Bas van Dijk [EMAIL PROTECTED] wrote:
The following obviously doesn't work:
inv m = (m mzero) `mplus` return ()
because it will always return ().
How about:
inv m = do
success - (m return True) `mplus` return False
if success then mzero else return ()
On Feb 7, 2008 7:32 AM, Uwe Hollerbach [EMAIL PROTECTED] wrote:
pure_fn :: Integer - String
pure_fn n = calendarTimeToString (toUTCTime (TOD n 0))
make_wicked :: String - IO String
make_wicked str = return str
-- use of make_wicked
main = (make_wicked (pure_fn 1234567890)) =
On Feb 5, 2008 2:50 AM, Adrian Hey [EMAIL PROTECTED] wrote:
I think it bites a lot less often than it otherwise would because most
people will deliberately chose to use heap in preference to stack (at
least when writing eager code) just to avoid the problem. But it still
bites pretty often
On Feb 5, 2008 7:48 AM, Matthew Sackman [EMAIL PROTECTED] wrote:
So I was thinking how dull and uninspiring the current definiton of
Monad really is and came up with some more interesting
parameterisations. The only problem with this one is I'm a) not sure if
it still is a Monad and b) very
On Feb 5, 2008 4:36 PM, Jeff φ [EMAIL PROTECTED] wrote:
I want to say thanks to everyone who responded to my mutable array post.
I'm going to work through and experiment with all the comments people
posted. It might take me a while.
Luke Palmer wrote:
Hmm, how big is the array? If it's
On Feb 5, 2008 6:50 PM, Adrian Hey [EMAIL PROTECTED] wrote:
Luke Palmer wrote:
On Feb 5, 2008 2:50 AM, Adrian Hey [EMAIL PROTECTED] wrote:
I think it bites a lot less often than it otherwise would because most
people will deliberately chose to use heap in preference to stack (at
least
On Feb 5, 2008 9:44 PM, Uwe Hollerbach [EMAIL PROTECTED] wrote:
lisp (UTCtime)
Wed Feb 6 03:57:45 UTC 2008
---
lisp (UTCtime 1.203e9)
Thu Feb 14 14:40:00 UTC 2008
--
But after that, it sure seems to me as if I've taken data out of the
IO monad... haven't I? Given that the second
I prerequest your forgiveness if I sound patronizing, I'm just writing
everything that comes to mind.
2008/2/2 Jeff φ [EMAIL PROTECTED]:
{-# OPTIONS_GHC -fglasgow-exts -fbreak-on-exception #-}
-- normalize_ary This takes a mutable array. Determines the largest
-- element in the array
Look at the type of tail:
tail :: [a] - [a]
That is, tail is the list of all elements *except* the head. You want last.
(Barring style considerations. Usually in a situation like this you
would use a list of tuples rather than a list of lists, since then you
know at compile time that you have
On Jan 30, 2008 11:05 AM, Gracjan Polak [EMAIL PROTECTED] wrote:
My strictness analyser in my brain hurts. Which one (foldl,foldl',foldr) is
the
best way?
Prelude Data.Set Data.List let s = fromList [1,2,3,4,5]
Loading package array-0.1.0.0 ... linking ... done.
Loading package
On Jan 15, 2008 12:29 AM, [EMAIL PROTECTED] wrote:
Ben Franksen writes:
[EMAIL PROTECTED] wrote:
...
Does *MATH* answer the question what is: (0/0)==(0/0) ? Nope!
Exactly. So why try to give an answer in Haskell? MATH says: the
expression 0/0 is undefined, thus comparing (0/0)==(0/0)
On Jan 12, 2008 9:19 PM, Rafael Almeida [EMAIL PROTECTED] wrote:
After some profiling I found out that about 94% of the execution time is
spent in the ``isPerfectSquare'' function.
That function is quite inefficient for large numbers. You might try
something like this:
isPerfectSquare n =
speed boost.
Luke
On Jan 12, 2008 9:48 PM, Luke Palmer [EMAIL PROTECTED] wrote:
On Jan 12, 2008 9:19 PM, Rafael Almeida [EMAIL PROTECTED] wrote:
After some profiling I found out that about 94% of the execution time is
spent in the ``isPerfectSquare'' function.
That function is quite
On Jan 12, 2008 11:30 PM, David Benbennick [EMAIL PROTECTED] wrote:
On 1/12/08, Henning Thielemann [EMAIL PROTECTED] wrote:
Caching is not the default, but you can easily code this by yourself:
Define an array and initialize it with all function values. Because of
lazy evaluation the
501 - 600 of 675 matches
Mail list logo