Hi Daniel,
Could you please explain what does mean 'monomorphic' in this context?
I thought that all type variables in Haskell are implicitly
universally quantified, so (a -> a) is the same type as (forall a. a
-> a)
Thank you,
Vladimir
On 6/1/09, Daniel Fischer wrote:
> Am Montag 01 Juni 2009
On Mon, Jun 1, 2009 at 11:18 PM, Tom Hawkins wrote:
> My family and I are moving in the coming months. My wife will be
> attending a new school in the fall. Among the many hassles of moving
> are locating and transferring medical records to new doctors and
> clinics. During our time in Minnesot
My family and I are moving in the coming months. My wife will be
attending a new school in the fall. Among the many hassles of moving
are locating and transferring medical records to new doctors and
clinics. During our time in Minnesota, we've visited several clinics
and hospitals, so our medica
On 2 Jun 2009, at 3:39 pm, Dan Cook wrote:
Hi,
(Relatively new to Haskell here ..)
So I have the following:
data MyVal = Atom String
| Bool Bool
And I want to do something like this
check :: (Bool -> MyVal) -> MyVal -> True
check f (f x) = True
check _ _ = False
Wh
> graph5.hs:37:9:
> Warning: No explicit method nor default method for `mzero'
> In the instance declaration for `MonadPlus Failable'
This warning is saying you didn't finish the declaration.
Try something like
instance MonadPlus Failable where
mplus (Fail _) y = y
mplus x _ = x
I didn't know I could do that. Works fine. Output below. Thanks!
This is some pretty neat stuff, and I've only scratched the surface.
Michael
===
[mich...@localhost ~]$ ghci
GHCi, version 6.10.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... d
Oh I wasn't clear -- you need multiple instance declarations for a
given type (Failable, for example), one for each type class you're
implementing.
That is,
instance Monad Failable where
return = ...
...
instance MonadPlus Failable where
mplus = ...
...
-Ross
On Jun 1, 2009,
Hi Ross,
I thought of that, but return, fail, and >>= became "not visible" when I
changed the instance declaration from Monad to MonadPlus.. Can Failable be in
two instance declarations, one for Monad (giving it return, fail, and >>=) and
one for MonadPlus (giving it mplus)?
Michael
--- On Mo
mplus is a method of class MonadPlus, so you need to write it in a
separate instance from the one for Monad, e.g.
instance MonadPlus Failable where
mplus = ...
-Ross
On Jun 1, 2009, at 9:28 PM, michael rice wrote:
Still stumped. Maybe and [] are in the same MonadPlus monad, but how
do
Still stumped. Maybe and [] are in the same MonadPlus monad, but how do I make
monad Failable understand mplus?
I'm now getting this error upon loading:
Prelude> :l graph5
[1 of 1] Compiling Main ( graph5.hs, interpreted )
graph5.hs:36:4: `mplus' is not a (visible) method of class
Hi Dan,
On Mon, Jun 1, 2009 at 8:39 PM, Dan Cook wrote:
> Hi,
> (Relatively new to Haskell here ..)
>
> So I have the following:
>
> data MyVal = Atom String
>| Bool Bool
>
> And I want to do something like this
>
> check :: (Bool -> MyVal) -> MyVal -> True
> check f (f
Hi,
(Relatively new to Haskell here ..)
So I have the following:
data MyVal = Atom String
| Bool Bool
And I want to do something like this
check :: (Bool -> MyVal) -> MyVal -> True
check f (f x) = True
check _ _ = False
What that means is I want to pass a MyVal constr
Do you argue that overloading logical operations like this in
Haskell
sacrifices type safety? Could programs "go wrong" [1] that use such
abstractions?
If I understand your point correctly, you are suggesting that such
programs
are still type safe.
My asking was really meant as a question t
Got it.
Thanks!
Michael
--- On Mon, 6/1/09, Daniel Fischer wrote:
From: Daniel Fischer
Subject: Re: [Haskell-cafe] Missing a "Deriving"?
To: haskell-cafe@haskell.org
Date: Monday, June 1, 2009, 1:51 PM
Am Montag 01 Juni 2009 19:02:36 schrieb michael rice:
> All good so far, but then tried t
I once thought, that error messages must be configurable by libraries,
too. This would be perfect for EDSLs that shall be used by non-Haskellers.
Yes, that is a problem.
But I have no idea how to design that.
There was some work in that direction in the context of the Helium
project. See th
It's too wordy, but it's a start. This is also prime ground for wanting
to have configurable levels of error reports, since some users will find
it helpful to see both types but others will find it confusing.
Indeed. For this simple example, I find Hugs' message nearly optimal,
but as one could
And rename "empty" to "fail"? You managed to confuse me since I always
use pSucceed to recognise the empty string.
Doaitse
On 1 jun 2009, at 01:21, Ross Paterson wrote:
On Sun, May 31, 2009 at 09:40:38PM +0200, S. Doaitse Swierstra wrote:
A new version of the uu-parsinglib has been uploade
Do you argue that overloading logical operations like this in Haskell
sacrifices type safety? Could programs "go wrong" [1] that use such
abstractions?
If I understand your point correctly, you are suggesting that such programs
are still type safe. I agree with the claim that such features are
Am Montag 01 Juni 2009 19:02:36 schrieb michael rice:
> All good so far, but then tried to convert Failable from Computation to
> Monad
>
>
> instance Monad Failable where
> return = Success
> fail = Fail
> >>= (Success x) f = f x
> >>= (Fail s) _ = Fail s
> mplus (Fail _) y =
Dear Group,
I've spent the last few days trying to convert a bunch of mysql tables into
couchdb using haskell, and I've documented my efforts, in case anyone else
intends to wander in similar waters. The tutorial is at:
http://maztravel.com/haskell/mySqlToCouchDB.html
comments welcome here at t
On Sun, May 31, 2009 at 06:20:23PM -0700, Iavor Diatchki wrote:
>
> and so on. It is a bit verbose, but you only have to do it once for
> your protocol, and then you get the nice overloaded interface.
This also seems like the kind of thing perfectly suited to Template
Haskell. Especially if the
I went back and tried to convert the YAHT example to Monad, importing Monad,
commenting out all but the data descriptions and the searchAll function, and
finally replacing success, failure, augment, and combine in the searchAll
function with return, fail, >>=, and mplus.
*Main> let g = Graph [(
On Mon, Jun 1, 2009 at 3:06 AM, Sebastian Fischer <
s...@informatik.uni-kiel.de> wrote:
> On Jun 1, 2009, at 12:17 AM, Henning Thielemann wrote:
>
> On Thu, 28 May 2009, Bulat Ziganshin wrote:
>>
>> i use another approach which imho is somewhat closer to interpretation
>>> of logical operations
Am Montag 01 Juni 2009 14:44:37 schrieb Vladimir Reshetnikov:
> Hi,
>
> I tried this code:
>
> ---
> f, g :: a -> a
> (f, g) = (id, id)
> ---
>
> Hugs: OK
>
> GHC:
> Couldn't match expected type `forall a. a -> a'
>against inferred type `a ->
Hi,
I tried this code:
---
f, g :: a -> a
(f, g) = (id, id)
---
Hugs: OK
GHC:
Couldn't match expected type `forall a. a -> a'
against inferred type `a -> a'
In the expression: id
In the expression: (id, id)
In a pattern binding:
Hello Dmitry,
Monday, June 1, 2009, 4:24:36 PM, you wrote:
> All network operations are run in separate thread, but sometimes input
> from user is needed. Afaik, gtk2hs is not thread safe, so I came up with
look for postGUISync and postGUIASync
--
Best regards,
Bulat
Greetings, fellow haskellers.
Currently I'm writing some kind of web crawler in haskell with gtk2hs gui.
All network operations are run in separate thread, but sometimes input
from user is needed. Afaik, gtk2hs is not thread safe, so I came up with
following:
I create two mvars, A and B, one
That is quite spectacular. I revised my knowledge of sequence
with a little function, akin to "sequence [xs1,xs2]":
seq2 xs1 xs2 = do x1 <- xs1
x2 <- xs2
return [x1,x2]
> seq2 [0,1] [0,1,2]
> [[0,0],[0,1],[0,2],[1,0
The iota function you're looking for can be a whole lot simpler if you
know about monads (list monad in particular) and sequence. For lists,
sequence has the following behaviour:
sequence [xs1,xs2, ... xsn] =
[[x1,x2, ... , xn] | x1 <- xs1, x2 <- xs2, ... , xn <- xsn]
Using this, you can red
On Jun 1, 2009, at 12:17 AM, Henning Thielemann wrote:
On Thu, 28 May 2009, Bulat Ziganshin wrote:
i use another approach which imho is somewhat closer to
interpretation
of logical operations in dynamic languages (lua, ruby, perl): [...]
The absence of such interpretations and thus the inc
Hello all
I recently found strange problem in use of inf-haskell + ghci on my Mac OS
X Tyger. I haven't used inf-haskell for a some time, and several days ago
i found, that it stopped to work - when I run C-c C-l (load file) it signal
error, and when I perform C-c C-b (start interpreter) it load
Hi all,
I was looking for an APL-style "iota" function for array indices. I
noticed
"range" from Data.Ix which, with a zero for the lower bound (here
(0,0)),
gives the values I need:
> let (a,b) = (2,3)
> index ((0,0),(a-1,b-1))
> [(0,0),(0,1),(0,2),(1,0),(1,1),(1,2)]
However, I nee
Hello Gwern,
Monday, June 1, 2009, 4:35:25 AM, you wrote:
> GHC mangles UTF by default. You probably want to use one of the utf8
> packages; eg.
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-string
> or
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-light
>
33 matches
Mail list logo