Hi
1) there are two independent filepath modules used with little
modifications in all projects i seen. They both included in MissingH
(FilePath.hs and NameManip.hs).
From what I can tell, FilePath.hs is the one from Cabal, which I
already used as a reference. As far as I can tell, this
Hi Jason,
As far as I am aware, the Win32 bindings are not that well maintained
currently, and programming against the Win32 API is quite painful
since it is a very low level, and very C like API.
Gtk2Hs does require additional dependancies, but seems to be the most
actively developed version.
Hi,
mymax [] = undefined
mymax (x:xs) = f x xs
where
f x [] = x
f x (y:ys) | y x = f y ys
| otherwise = f x ys
Or if you don't want to go for a fold next, in a style more similar to
the original:
maximum [] = undefined
maximum [x] = x
Hi
See section 7.1 in the latest HCAR at
http://haskell.org/communities/11-2005/html/report.html
Thanks
Neil
On 6/21/06, Andreas Kägi [EMAIL PROTECTED] wrote:
hello
i wonder if there are companies that use haskell in practice.
i'm a computer science student from switzerland (europe) and need
Hi,
I happen to like laziness, because it means that when I'm not thinking
about performance, I don't have to think about evaluation order _at
all_. And since my computer is a 750Mhz Athlon with Hugs, I never find
any need to worry about performance :) If it ever becomes an issue I
can move to
Hi
hugs (winhugs) is rather fast, loading several KLOCs per second, and
finally you can compile program with ghc
WinHugs (but not Hugs) also has a feature called auto-reload - if you
change and save any of the source code files it will automatically
detect and reload them - no more :r :)
Hi Sara,
This function will take the input as a string and return a list of
keywords taken from the input string and they are elements of
ListOfKeywords. The order of the result list is sequenced as: the last
keyword found is set as the first element of the list, and so on.
It looks like
Hi,
This can quite easily be formulated in terms of union and \\ (set
difference), both available in Data.List.
Thanks
Neil
On 6/18/06, Jenny678 [EMAIL PROTECTED] wrote:
Hello,
Know Somebody the code for symmetric difference (Sets)
examples
symmetric_difference [1..8][5..7]
[1,2,3,4,8]
Hi
On 6/18/06, Sara Kenedy [EMAIL PROTECTED] wrote:
Sorry, I am not clear at some point in your answer:
1) The function
lex :: String - [(String,String)]
and
filter :: (a - Bool) - [a] - [a]
So, I did not see how filter can use the list of tuple string of lex.
You can write a function
Hi Minh,
When I write Haskell, its because I want to write the code quickly,
not because I want it to run quickly. GHC is a wonderful compiler and
makes things go fast, but Hugs is faster at compiling, so I always use
Hugs (WinHugs in fact). If your focus is on things going fast, then
with
Hi Michael,
I have defined fromJustNote and headNote, which take an extra
parameter, for example:
fromJustNote msg (Just x) = x
fromJustNote msg Nothing = error $ fromJustNote failed, ++ msg
I also have lookupJust which does a lookup and a fromJust, since this
is a common pattern in my
Hi,
I think the kind of structure you are after is something like:
writeList [] = return ()
writeList (x:xs) = do writeHtml x
writeList xs
Which is already defined for you, using sequence_
Thanks
Neil
___
Hi Lyle,
I just installed the May 2006 release of Hugs. When I use the
command-line version, the '$$' symbol to reference the last expression
works fine. It does not work in WinHugs, but yields 'ERROR - Syntax
error in expression (unexpected symbol $$)'. I typed ':set' to verify
the '-r$$'
Hi,
I tend to use the module TextUtil (or Util.Text) from Yhc for these
kind of string manipulations:
http://www-users.cs.york.ac.uk/~malcolm/cgi-bin/darcsweb.cgi?r=yhc;a=headblob;f=/src/compiler98/Util/Text.hs
separate = splitList ,
I am currently thinking about making this module into a
Hi
beginsWith [] [] = True
beginsWith _[] = True
beginsWith [] _ = False
beginsWith (a:aa) (b:bb)
| a == b = aa `beginsWith` bb
| otherwise= False
I used to have this in my library then I discovered isPrefixOf :) (or
flip
Hi
- about formatted error messages (I am sure you guys
don't care), could someone build a light GHC front end
that given a .hs/.lhs file produces two XML files with
specified DTD, the parsed structure and the error
messages? the reason for choosing XML is that not only
the Java people
Hi Pete
As part of my learning experience, I think I want to see if I can
write a haskell pastebin that does proper syntax highlighting.
Someone in #haskell suggested that I use just a lexer because using a
parser is overkill. However, I can't make this assessment until I see
how to use the
Hi,
Haskell is based on indentation for grouping, so your code is fine,
you just need to indent the lines marked:
f :: (Float,Float) - Float
f (x,y) = (a(x,y) + 4) * (b(x,y) + 3)
where
a :: (Float,Float) - Float
a(x,y) = (x + y)*2
b :: (Float,Float) - Float
b(x,y) = (y -
Hi,
i want to change my input integers
In 23 98
Out 98 23
Can you explain what the bigger goal behind this is? It really depends
on exactly what you want to do, if you want a function that takes a
pair of integers and flips the pair, that's easy enough:
f (x,y) = (y,x)
But I guess you have
Hi
I have this basic question of how to print the character without
the backslash.
I'm trying to print html code, so i need a lot.
giveHtml (Leaf (a,(b,c))) = frame src=\\ name=\ ++ [a] ++ \
scrolling=\No\ noresize=\noresize\ id=\ ++ [a] ++ \ title=\
++ [a] ++ \ /
Can anybody give me a
Hi Deech,
1. Is there a way to output intermediate values of a calculation?
Debug.Trace.trace is what you want, its not quite as convenient (or
safe) as cout, but its usually good enough. If you want to see more
detail then Hat (http://www.haskell.org/hat) is probably what you
want.
From a
Hi,
I'm trying to manipulate predicates in Haskell, and was wondering if
there was a predicate library available that I could use?
My predicates consist of `and` and `or` over some constraints. I have
various rules which can be used to collapse certain constraints.
Currently I have written my
Hi Tim,
Is this what you're looking for?
http://www.cse.ogi.edu/~hallgren/Programatica/tools/property/Plogic.html
http://citeseer.ist.psu.edu/kieburtz02plogic.html
That looks very interesting and I'll certainly come back to that
later, but I couldn't see a predicate simplifier amongst that
Hi,
Pretty much every Haskell implementation supports the FFI - its a
standardised Haskell 98 extension. Take a look at the System.Win32
library which is a wrapper round the Windows API. If you have a
reference to the Win32 API (i.e. MSDN) then the API looks like a very
straightforward wrapper.
Hi,
I have a program which needs to cache intermediate data structures to
a file (finite, non-cyclic, relatively simple, around ~100Kb when
shown). Is there any easy way to acheive this?
The current approach I am using is to add deriving Read, Show to all
the data structures, and then
Hi
It fails with Hugs on both platforms on the runhugs Setup.lhs
configure step in the base HSQL library with:
Windows:
ERROR C:\Program
Files\WinHugs\libraries\Text\ParserCombinators\ReadP.hs:156 -
Syntax error in type expression (unexpected `.')
That looks like it requires haskell
Hi,
import Paths_haddock( getDataDir )
Haddock requires to be built with Cabal (which generates this module),
and as far as I can remember, its a Cabal that isn't released
anywhere. When I did some work on haddock I commented this out, and
made getDataDir return an empty list and then made
Hi,
Starting from YHC porting pages the only source for Win32 port I
found is WinHaskell.
[http://www-users.cs.york.ac.uk/~ndm/projects/winhaskell.php]
That's an entirely separate project, it just uses Yhc/GHC/Hugs.
Thats the things about the Yhc port to Windows - its not a port, Yhc
just
Hi,
If I was doing a Haskell port to PPC Windows Mobile, I'd start with
Yhc. If you port a small, portably written runtime (Yhi) in C, then
you get everything else for free.
There was some talk of a palm port of Yhi, and the only issues that
came up were:
* GMP is a dependancy, so you'll need
type SOA= Rec (properties :: PropList, time :: Time,
world :: World)
This type definition does not make use of standard Haskell records, I
suspect this is making use of Trex, although I don't know any of Trex.
I would have expected standard Haskell to look like:
Hi,
First, its useful to define referential transparency.
In Haskell, if you have a definition
f = not
Then this means that anywhere you see f, you can replace it with not.
For example
f True and not True are the same, this is referentially transparent.
Now lets define super show which takes
I think this is the monomorphism restriction, you can see more details
on the web page:
http://www.haskell.org/hawiki/MonomorphismRestriction
On 3/30/06, David Laffin [EMAIL PROTECTED] wrote:
Hi,
Newbie question. Given the inferred type for square,
the
inferred types for quad1, quad2 and
instead of coding them. I am thinking about an approach
based on a sort of DSL design with Haskell then code/bytecode
generation to Java/whatever platform.
Yhc can generate a portable bytecode, and it can also generate .NET
bytecode (IL), and there was a project underway to generate Java (JVM)
Doesn't Ada have constrained number types which have similar behaviour?
Yes. Just for comparison, the behaviour of the Ada number is to throw
an exception at runtime if a number overflows its bounds. If these
checks can be eliminated statically, then they are. If an operation
will always give a
Hi Greg,
But if I do something like this:
f lst = show (filter ( 1) lst, filter ( 2) lst)
then it looks like GHC won't garbage collect list elements
until the first
filter has completely finished
There is a very good reason for this, show (a,b) is essentially
show (a,b) = ( ++ show a
Hi,
Here would be a better example then.
f lst = show (sum (filter ( 1) lst), sum (filter ( 2) lst))
I suspected that you actually wanted to do something cleverer with
the list, for the sake of argument, I'm going to change 1 to p1 and
2 to p2 - to show how this can be done in the general
Thanks Neil. How do I add in another ~10 computations, or map a list of a
100 computations to the same input?
Isn't there a way to do this without one computation having to be aware of
the other?
I guess they have to be aware at some level, perhaps arrows generalise
the awareness they need,
Hi
Is it possible to have an RSS feed for Planet Haskell? i.e. so I can
read all the Haskell related blogs with my feed reader without being
subscribed to all of them individually.
Thanks
Neil
On 3/23/06, Antti-Juhani Kaijanaho [EMAIL PROTECTED] wrote:
Isaac Jones wrote:
Cool, if you think
Hi,
Does it really have to change statically?
I use code like:
#ifdef __WIN32__
(Windows code)
#else
(Linux code)
#endif
In Yhc, we use a runtime test to check between Windows and Linux. It
has various advantages - we only have one code base, everything is
type checked when we
Hi,
I disagree with most people on this, since I am in general principle
opposed to monads on the grounds that I don't understand them :)
o How important is it that I switch from using the State monad to using
arrows?
I don't understand either monads or arrows
o How important is it that I
How's this?
What about ++, in Haskell thats just an ordinary function, yet you are
using the library one in this case.
The other thing is that the first definition of my_concat_map is
entirely redundant, the second one handles both cases anyway.
Also, for completeness, you might be interested
I'm not sure I agree that is a good reason.
I never claimed it was a good reason, merely that it was a reason :)
Hoogle 2 only allowed you to search the Haskell 98 libraries, which
obviously everyone wants to do. Hoogle 3 is still in beta - I
introduced searching more, but have not got round to
dropTrailNulls list = reverse (dropWhile null (reverse list))
Or more succinctly:
dropTrailNulls = reverse . dropWhile null . reverse
Or, is there a more efficient idiom for addressing these problems?
The bad thing about this definition is that it is tail strict. Consider
Well, this a bold assumption IMHO, and I'm not particularly
happy with that, as you can probably imagine.
I would also imagine that Joe Programmer is more likely to use
wxHaskell or Gtk2Hs than those - however because those are outside the
standard tree they don't make it in. I don't think much
Hi,
You seem to like let a lot, whereas I hardly ever use them. In general
I find where a lot more readable.
(disclaimer, all notes untested, may not compile, may be wrong)
Also, most haskell programs use $ instead of |
-- For convenience:
currTokType :: ParseContext - TokenType
currTokType
Hi
do x - readFile test.txt
print (length (lines x))
That prints out the number of lines in a file, but once you have done
lines x, you can do anything you want to the lines
Thanks
Neil
On 3/5/06, Richard Gooding [EMAIL PROTECTED] wrote:
Hi,
can someone please point me at some code to
And a related question is: Which packages are searchable by Hoogle?
The best answer to that is some. I intentionally excluded OpenGL and
other graphics ones because they have a large interface and yet are
not used by most people using Haskell.
I have recently patched Haddock so it will directly
Hi Pete,
a = ()
b x = (x )
c x y = (x y)
I'm pretty sure this is the Monomorphism Restriction, its on the wiki
at: http://www.haskell.org/hawiki/MonomorphismRestriction
Thanks
Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Hi,
I have a nice big data structure that I serialise to a file using
show, and read back in using read. This data structure has
deriving (Read, Show), which makes it all nice and easy to save and
load this data structure, without worrying about parsing code etc.
The problem is that this data
Hi Radu,
Is there a sort function in the libraries that come with GHC (6.4)?
import Data.List
Or just hit Hoogle with sort
http://haskell.org/hoogle/?q=sort
Thanks
Neil
On 16/02/06, Radu Grigore [EMAIL PROTECTED] wrote:
My search at
Honestly, don't use read. It's icky.
Check out ReadP or parsec, they are far superior in general. I think
there was a suggestion of replacing Read with ReadP?
The whole point is not about writing a parser, its about having a
parser written for me with deriving Read - unfortunately their is no
It does, in practise - but this might not be done as part of the
tranformation - it might be done as part of the preparation.
It can't be done before any transformations, since the URI can be a
function, and the result of that function might be defined in terms of
transformations and the nodes
Hi,
I don't know of any, but there may well be, I've never looked.
It probably wouldn't be that difficult to do, since XSLT is a
functional language. There is probably lots of code in HaXml you could
reuse (since the syntax for XSLT is XML). The only slightly taxing
thing would be that XSLT is
Hi,
up one time or another. If someone is interested, I have some Java
code for compiling Haskell98 to bytecode that I would be more than
willing to share. It is not in the best shape and does not implement
You might also be interested in:
http://www.brianweb.net/personal/blog/entry.php?id=18
Hi,
Can I use Haskell to do what people do with, say, PHP?
I wrote Hoogle (http://haskell.org/hoogle) using Haskell, without
using any libraries - just directly as a console program. It's open
source so you can download it and see how its done, if you want. Of
course the web handling bit is
Hi
My knowledge of Clean is fairly limited
Mine too, but one of the biggest differences is that Clean has
uniqueness types instead of Monads.
They are in fact so similar that you can convert between them, using
Hacle: http://www-users.cs.york.ac.uk/~mfn/hacle/
I believe also that Clean has a
On 1/5/06, Scherrer, Chad [EMAIL PROTECTED] wrote:
Interesting. Have there been any performance comparisons vs GHC et al?
Yes:
http://www-users.cs.york.ac.uk/~mfn/hacle/index.html#fin
http://www-users.cs.york.ac.uk/~mfn/hacle/eval.html
___
Hi Robert,
The first thing to mention is that Haskell uses linked-lists, not
arrays as the standard list type structure, so [1,2] is actually a
linked list.
The next thing to note is that Haskell is *lazy*. It won't do work
that it doens't have to. This means that you can return a linked list
Hi,
All Haskell functions are lazy, hence there is no need to write a
lazy version of your print_list function. I think the function you
probably want is:
putStr (unlines xs)
This uses the bulid in unlines function, which is similar in spirit to
join (you get more quotes, which I guess you
You could also learn from the code and documentation of the various
implementations of Haskell: GHC, hugs, nhc, and
- YHC (http://www-users.cs.york.ac.uk/~ndm/yhc/) (an nhc derivatibe)
including a portable bytecode compiler
With Yhc, there is also a quite useful wiki at
Hi,
Hugs Interpreter onlySuitable for learning. You'll need GHC for
serious work.
This is putting Hugs down quite a bit. I personally prefer Hugs, and
use it for serious work (including developing a Haskell compiler, and
4 years of academic study and counting). About the only thing
I don't think restricting editing to registered users is a significant
turn off if registration is simple.
It really really is a turn off. Sometimes when I spot a mistake, and
I'm at a computer where I haven't logged in to hawiki, I don't bother
fixing it. No one wants to have yet another
1) where can i find articles from Estonia conference?
There were several conferences in Estonia including TFP, ICFP and
Haskell Workshop. Go to http://www.cs.ioc.ee/tfp-icfp-gpce05/, look at
the program, type in the title of the talk and most of the time google
will give you a copy of the
As someone who is not an academic researcher and not a student in CS,
I would like to express a personal opinion; we don't need a new
standard.
Maybe you just don't realise how much we do need a new standard!
standard. To me, Haskell needs more libraries, more users (which
means more
isString::(Show a) =a -Bool
This function will return True if the input is a string and return False if
not
This is not particularly nicely - you certainly can't write it as
simple as the 'isString' function, and it will probably require type
classes etc, quite possibly with haskell extensions.
It was a demonstration, not a paper. The half page thing is all there
is. There were however slides that went with the presentation which
you might be able to get off the author. I think its also being
released open source, so you could even put your home directory on it
:)
Neil
On 10/6/05,
Take a look at unsafePerformIO, it is of type IO a - a. Its not
particularly safe (the name gives a clue), but it does what you
want.
On 9/20/05, Mark Carter [EMAIL PROTECTED] wrote:
I'm puzzling out how to get a Bool from am IO Bool. I know I'm not
supposed to, but I don't see any way around
So I think
map ( (flip foo) 5 ) my_list_of_lists_of_doubles
will work, as will using a lambda expression
map (\x - foo x 5) may_list_of_lists_of_doubles
I really like the `foo` syntax.
map (`foo` 5) my_list
also works, without an auxiliary function and without a lambda. In
reality this
Hi,
The CVS version of Hugs for Windows has a module
System.Win32.Registry, along with quite a few other windows modules.
I'm not sure if the last stable releases have these features in or not.
Thanks
Neil
On 9/11/05, Brian McQueen [EMAIL PROTECTED] wrote:
How can I use Haskell to do general
Hi Jake,
program. How do most of the folks here debug their large code base?
You might have some success with Hat, http://www.haskell.org/hat/, for
debugging.
Unfortunately unless you are doing Monadic computations, breakpoints
don't really work as well as in strict imperative programs.
Hi,
Yes, sounds like a good idea. I'm not sure the right approach is to
make the user give this information though - the code will very likely
be something like
doSomethingToAModule (SModule a b) = f a b
from which you can derive the type SCode(SModule) very easily. As the
expressions get more
901 - 971 of 971 matches
Mail list logo