PROTECTED]
cc:[EMAIL PROTECTED], (bcc: Chris Angus/Lawson)
Subject:Re: Design patterns in Haskell
size. while there's really no substitute for experience, i really
believe we could benefit from some patterns.
There was a list of design patterns for Haskell on the Wiki (back
Does anyone know what happened to the wiki on haskell.org?
There was lots of stuff there last year (mostly to do with design patterns) which seems to have been lost.
Some of the links are still there but they don't go anywhere.
Cheers
Chris
Title: RE: String manipulation.
You may want to use reads
as read will call error if the
string is not an integer
or use something akin to the example below
readMaybeInt :: String - Maybe Int
readMaybeInt s = case reads s of
[(x,_)] - Just x
_ - Nothing
-Original Message-
Title: RE: Implicit Parameters
I'm obviously missing something here.
I dont understand what monomorphism has to do with
the given example as the implicit parameter would be
the same type [a] for some type a in each case.
If we made the parameter explicit then
removing the type
Title: RE: Help using a state monad
your pattern match
of (s:sx) seems to be the cause of the delay
try
--Process the input
mProcess :: String - State String
mProcess sx = do b - isOn
if ( head sx == 't' )
then toggle
else return ()
appOut (tuUpper b (head sx)) (mProcess (tail sx))
is this not the dictionary passing (or whatever)to achieve overloading.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 13 April 2001 06:48
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Question about hugss DEBUG_SHOWSC
hi
Faizan,
A clue is to use list comprehensions (which are very like ZF set notation)
First think how you would define a cartesian product in set notation
X x Y x Z = {(x,y,z) | ...}
and then think how this is written in list comprehension notation
Chris
-Original Message-
From:
why not create an abstract datatype
OpenFile a which is a monad
data OpenFile a = OpenFile (Maybe FileHandle - IO a)
and create you operations in terms of this
openFile :: String - OpenFile ()
count:: OpenFile Int
read :: Int - OpenFile [Byte]
then you could habe a run function
diff fn | match fn cosine = neg `compose` cosine
-Original Message-
From: Jose Romildo Malaquias [mailto:[EMAIL PROTECTED]]
Sent: 25 September 2000 12:14
To: Chris Angus
Cc: [EMAIL PROTECTED]
Subject: Re: Extensible data types?
On Mon, Sep 25, 2000 at 11:37:24AM +0100, Chris
Hi,
I looked at HaXml a while ago
and it seemed to offer a very Dom-like interface.
I was wondering if anyone had thought of making a Sax-like
interface based on lazy evaluation. where tokens are
processed and taken from a (potentially) infinite stream
Chris
Just wondering if you'd seen the dynamic
datatype which basically gives you an "Any"
in ghc/hugs
-Original Message-
From: Jose Romildo Malaquias [mailto:[EMAIL PROTECTED]]
Sent: 25 September 2000 12:14
To: Chris Angus
Cc: [EMAIL PROTECTED]
Subject: Re: Extensible
Presumably this means differentiation/integeration would have to be typed as
diff :: (FnExt a,FnExt b) = a - b
Chris
-Original Message-
From: Peter Achten [mailto:[EMAIL PROTECTED]]
Sent: 25 September 2000 23:34
To: Jose Romildo Malaquias
Cc: [EMAIL PROTECTED]
Subject: Re:
yntax tree rather than string) chain of
responsibility
*) Non-trivial type synonyms
i.e. data Miles = Miles Int rather than
type Miles = Int
can remove later anyway
-Original Message-----
From: Chris Angus [mailto:[EMAIL PROTECTED]]
Sent: 11 September
I've thought of this too.
but I dont think there is anything out there
which fits the bill.
[I'd love someone to please correct me]
btw for any folks out there who are thinking
what the are patterns?
http://www.enteract.com/~bradapp/docs/patterns-intro.html
I think it would be a good
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 08 September 2000 17:17
To: [EMAIL PROTECTED]
Subject: Re: Inferring types
Sat, 9 Sep 2000 00:56:46 +1100, Fergus Henderson
[EMAIL PROTECTED] pisze:
If you define `p' as a syntactic function, e.g.
-Original Message-
From: Keith Wansbrough [mailto:[EMAIL PROTECTED]]
Sent: 11 September 2000 15:07
To: Chris Angus
Cc: 'Doug Ransom'; [EMAIL PROTECTED]
Subject: Re: Patterns Catalog
I've thought of this too.
but I dont think there is anything out there
which fits
I have used alex / happy a few times
without too many problems I believe happy
now contains yacc style information
for operator precidence :-).
If I were you I would use
Happy + Alex for the scanner/parser.
but use asdl for the definition of the
data structures.
(There is a link to this
from
For doinjg this sort of thing I have used asdl before
which I find really useful.
-Original Message-
From: Manuel M. T. Chakravarty [mailto:[EMAIL PROTECTED]]
Sent: 23 August 2000 14:09
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: code generation for other languages
-Original Message-
From: Matthias Kilian [mailto:[EMAIL PROTECTED]]
Sent: 06 August 2000 22:01
To: Mirko Pracht
Cc: [EMAIL PROTECTED]
Subject: Re:
On Sun, 6 Aug 2000, Mirko Pracht wrote:
average x | null x= 0.0
What does you make thinking the average of an
I would start by splitting the problem up
tupleSum :: [Int]- (Int, Int)
tupleSum xs = (neg, pos)
where neg = ... SOME EXPRESSION INVOLVING xs
...
pos = sum [ x | x - xs , x 0]
-Original Message-
From:
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 25 July 2000 09:30
To: [EMAIL PROTECTED]
Subject: Re: The type of zip
Mon, 24 Jul 2000 09:04:58 +0100, Chris Angus
[EMAIL PROTECTED] pisze:
I dont agree. To me it seems simply like a logical
A little off-topic i know but ...
Has anyone ever thought of trying to use reflection in these cases.
i.e. still declare the instance but have a common method which
examines the arguments and dynamiclly constructs the result depending
(dynamically) on the type of the argument.
I have never
Aren't most of these "java additions" MS J++ or MS specific
rather than java/jdbc "run-anywhere" though?
Hoping that this isnt the case
Chris
-Original Message-
From: Frank Atanassow [mailto:[EMAIL PROTECTED]]
Sent: 19 July 2000 10:22
To: S. Alexander Jacobson
Cc: Manuel M. T.
Do you derive Show for MyData?
-Original Message-
From: Mike Jones [mailto:[EMAIL PROTECTED]]
Sent: 09 May 2000 05:58
To: [EMAIL PROTECTED]
Subject: Showing tuples
Hi,
I am having trouble with Show and tuples.
I have a data structure, say:
data MyData = ...
And a
(",",s6) - lex
s5A,
(v6,s6A) - reads
s6,
(")",s3) - lex
s2A ])
-Original Message-
From: Mike Jones [mailto:[EMAIL PROTECTED]]
Sent: 09
-Original Message-
From: Peter Hancock [mailto:[EMAIL PROTECTED]]
Sent: 28 April 2000 10:23
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: doubly linked list
"Jan" == Jan Kort [EMAIL PROTECTED] writes:
Anyway, a doubly linked list could be defined like
Would it not be better to tag a start point then we can manipulate this
easier
and move it back to a singly linked list etc.
data Db a = Dd (Db a) a (Db a)
| DStart (Db a) a (Db a)
instance Show a = Show (Db a) where
show xs = show (enumerate xs)
instance Eq
You could try this:
--OpenFile.hs
module OpenFile where
import IOExts
openfile :: String - String
openfile = unsafePerformIO . readFile
-- end of file
-Original Message-
From: Hamilton Richards [mailto:[EMAIL PROTECTED]]
Sent: 26 April 2000 14:04
To: [EMAIL PROTECTED]
Subject:
Hi,
I was wondering if there was any way to run code which possibly
threw an error in any version of Haskell.
e.g.
efficient3rdPartyAlgorithm :: Int - Int
myOwnSlowAlgorithm :: Int - Int
i.e. the idea is you run the efficent version and if
falls over you run your own version.
Cheers
Chris
Does anyone know where I can get some
information on Lambada.
I tried
http://windows.st-lab.cs.uu.nl/Lambada/
but got a 403 (not authorised to view page)
Cheers
Chris
Dear All,
I am using Haskell (via ASDL) to write a translator
(target language = java) and have designed an AST for Java.
I want to be able to do fairly powerful source to source
manipulations on this java tree and as such would value
any constructive criticism of the way I have put together
I am currently using Haskell at work although
not to develop end - software
We have a lot of legacy code which we want to convert to Java
I am using a combination of
happy , alex, asdlGen, hugs and GHC, writing in a monadic style.
I tried to use Haxml but found it
too
I posted this to comp.lang.functional a while ago but (apparently) no one
had an opinion which
I cant believe is the case :-)
Chris
I would be interested to know people's views on adding reflection to Haskell
to get Factory-like behaviour.
I was thinking that other modules could "export"
read "
+ suffix +" files does not exist")
Just f - f filename
-Original Message-
From: Peter Hancock [mailto:[EMAIL PROTECTED]]
Sent: 25 January 2000 11:13
To: Chris Angus
Subject: Relection
"Chris" == Chris Angus
Ok ... this is a lot neater than what I had in mind but what about the
reflective part?
-Original Message-
From: Daan Leijen [mailto:[EMAIL PROTECTED]]
Sent: 15 December 1999 10:49
To: 'Chris Angus'; [EMAIL PROTECTED]
Subject: RE: Singletons and Reflection
What do folk out there think
Hi,
What do folk out there think to the idea of having a std module
in Haskell which contains dynamic environment info.
things I mean are
progName :: String
args:: String
and maybe funs like
getProperties :: FileName - PropertyLookup
(obviously this getProperties fn whould have to
Hi all.
Steve Frampton [EMAIL PROTECTED] wrote:
foo x = ['1'] ++ foo(x div 10)
*** term : foo
*** type : ((a - a - a) - b - Int) - [Char]
*** does not match : Int - [Char]
Can someone please explain how to decipher the type line in this error
I'm guessing that the problem is that
fos -0.5 [1,1,1,1]
is being parsed as
((fos) - (0.5)) [1,1,1,1]
so that the 0.5 implies an instance of class Fractional which implies
by the type of (-)
(-) :: Num a = a - a - a
that fos is also
38 matches
Mail list logo