There seems to be a small group of Haskell users who are interested in building and using interfaces to databases. Would it be possible to set up a mailing list for those interested? I'd be happy to administer it if required (although someone would have to show / tell me what needs doing). Dominic Steinitz
"Dominic Steinitz" <dominic.steinitz@blueyonder.co.uk> writes:
Would it be possible to set up a mailing list for those interested?
We're getting a lot of these lists now (gui, libs, cafe) -- are they really warranted? Couldn't they all fit in the libraries list? I'd like to keep an ear to all of these developments, and it's not like traffic is all that high at the moment. -kzm -- If I haven't seen further, it is by standing in the footprints of giants
yeah, the proliferation of lists can inhibit conversation if a critical mass of subscribers isn't reached. rather than start with a new list, discuss on the list which matches the most (libraries@haskell.org probably) and then eventually start a new list if it seems warrented. John On Thu, Jan 23, 2003 at 08:10:57AM +0100, Ketil Z. Malde wrote:
"Dominic Steinitz" <dominic.steinitz@blueyonder.co.uk> writes:
Would it be possible to set up a mailing list for those interested?
We're getting a lot of these lists now (gui, libs, cafe) -- are they really warranted? Couldn't they all fit in the libraries list? I'd like to keep an ear to all of these developments, and it's not like traffic is all that high at the moment.
-kzm -- If I haven't seen further, it is by standing in the footprints of giants _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
-- --------------------------------------------------------------------------- John Meacham - California Institute of Technology, Alum. - john@foo.net ---------------------------------------------------------------------------
Hey all. I am trying to declare a read-only state monad and a read-write state monad, so as to distinguish between methods on a data type that are read-only vs. read-write. This is the best I could come up with: newtype ST s a = ST ( s -> (s,a) ) -- read-only newtype SW s a = SW ( s -> (s,a) ) -- read-write class ReadM m s a where readM :: m s s runM :: s -> m s a -> (a,s) class WriteM m r s where updateM :: (s -> s) -> m s () instance ReadM ST s a where readM = ST (\s -> (s,s)) runM s (ST c) = c s -- Doesn't work instance ReadM SW s a where readM = SW (\s -> (s,s)) runM s (SW c) = c s -- Doesn't work And later on ... updateM s (SW c) = c s Does that make sense? If not, how do I do it? If so, is there a simpler means of getting there? Thanks. ;Amit ------------------------------------------------------------------- Amit Garg | Office: ACES 6SEo4E Graduate Student | Phone : (512) 232-7875 Computer Sciences | Res : 2000 Pearl St. #209 University of Texas at Austin | Phone : (512) 659-2532 Homepage: http://www.cs.utexas.edu/~amitji -------------------------------------------------------------------
Amit Garg wrote:
Hey all.
I am trying to declare a read-only state monad and a read-write state monad, so as to distinguish between methods on a data type that are read-only vs. read-write.
This is the best I could come up with:
newtype ST s a = ST ( s -> (s,a) ) -- read-only newtype SW s a = SW ( s -> (s,a) ) -- read-write
class ReadM m s a where readM :: m s s runM :: s -> m s a -> (a,s)
class WriteM m r s where updateM :: (s -> s) -> m s ()
instance ReadM ST s a where readM = ST (\s -> (s,s)) runM s (ST c) = c s -- Doesn't work
instance ReadM SW s a where readM = SW (\s -> (s,s)) runM s (SW c) = c s -- Doesn't work
And later on ... updateM s (SW c) = c s
Does that make sense? If not, how do I do it? If so, is there a simpler means of getting there? Thanks.
1. You don't need multiparameter type classes for this. "class ReadM m where ..." and likewise for instance declarations suffices. 2. The declaration for runM in ReadM has wrong order of elements in the result tuple, that causes your "-- Doesn't work" type problems. 3. The suggested definition for updateM doesn't make sense, not even with respect to types. HTH, Janis. -- Janis Voigtlaender http://wwwtcs.inf.tu-dresden.de/~voigt/ mailto:voigt@tcs.inf.tu-dresden.de
hi, the read only "state" monad is usually called "environment", or "reader" monad. since it is goind to be "read-only" there is no need to return a new state in the result (as it would presumably be the same as the input state). so the type becomes: newtype Env e a = E (e -> a) for something simillar to what you have take a look at the Hugs/GHC monad transformer libraries, or at www.cse.ogi.edu/~diatchki/MonadTransformers bye iavor Amit Garg wrote:
Hey all.
I am trying to declare a read-only state monad and a read-write state monad, so as to distinguish between methods on a data type that are read-only vs. read-write.
This is the best I could come up with:
newtype ST s a = ST ( s -> (s,a) ) -- read-only newtype SW s a = SW ( s -> (s,a) ) -- read-write
class ReadM m s a where readM :: m s s runM :: s -> m s a -> (a,s)
class WriteM m r s where updateM :: (s -> s) -> m s ()
instance ReadM ST s a where readM = ST (\s -> (s,s)) runM s (ST c) = c s -- Doesn't work
instance ReadM SW s a where readM = SW (\s -> (s,s)) runM s (SW c) = c s -- Doesn't work
And later on ... updateM s (SW c) = c s
Does that make sense? If not, how do I do it? If so, is there a simpler means of getting there? Thanks.
;Amit ------------------------------------------------------------------- Amit Garg | Office: ACES 6SEo4E Graduate Student | Phone : (512) 232-7875 Computer Sciences | Res : 2000 Pearl St. #209 University of Texas at Austin | Phone : (512) 659-2532 Homepage: http://www.cs.utexas.edu/~amitji -------------------------------------------------------------------
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
-- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ==================================================
participants (6)
-
Amit Garg -
Dominic Steinitz -
Iavor S. Diatchki -
Janis Voigtlaender -
John Meacham -
ketil@ii.uib.no