At the moment the unix encrypted passwords are downloaded using
sov_slave (an application written by ICT that talks directly
to the SOV database)... As far as I am aware all unix cluster
in college that are part of ICTs single sign-on us this method
unless you have recently changed them...
I am
But if the forkIO'ed process terminates because of an exception, that
shouldn't influence the main process, right?
Well, if its unix you might have to set sigPIPE to Ignore...
Otherwise, the main process should not die just because the child has...
Keean.
Actually I now think that not only are top level TWIs okay, I can
get extra contexts by rewriting the MVar module. Here I can
create a TWI in the new MVar module called context, and all
mvar writes and reads would be parameterised by context. In
this way I can change the context then call oneShot
Of course you can do intertationalisation with show... There is a
paper on using type classes to define implicit confugurations,
perhasps someone can provide the reference?
This can be used to nicely redefine show... Ill see if I cant
dig out an example.
Keean.
My guess is because irrationals can't be represented on a discrete computer
Well, call it arbitrary precision floating point then. Having built in
Integer support, it does seem odd only having Float/Double/Rational...
Keean.
..
___
You don't want stdin/stdout/stderr?
Also these are only available in the IO monad...
without breaking referential transparency
by use of unsafePerformIO hack.
I don't understand this still... how can it not break referntial transparancy.
For example consider if stdin were available outside the
Eiffel can dispense with global variables not least because objects contain
mutable state. And the methods cann access this state inside their object
without taking it as an argument.
All of which you can do in Haskell (including the objects) with no additional
extensions, see:
I would be very careful of adding non-rationals to the Rational type.
Why is there no Irrational class. This would make more sense for
Floats and Doubles than the fraction based Rational class. We could
also add an implementation of infinite precision irrationals using
a
pair of Integers for
My guess is because irrationals can't be represented on a discrete computer
Well, call it arbitrary precision floating point then. Having built in
Integer support, it does seem odd only having Float/Double/Rational...
Keean.
..
___
nstance Typeable a = Typeable (MVar a) where
typeOf (x::x) =
mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf (undefined::x)]
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
My mistake:
instance Typeable a = Typeable (MVar a) where
typeOf (x::MVar x) =
mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf (undefined::x)]
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
Keith Wansbrough wrote:
Which brings me to a question: is there a better way to write -inf and
+inf in Haskell than -1/0 and 1/0?
Why not do it with types:
data InfDbl = Dbl Double | PositiveInfinity | NegativeInfinity
Keean.
___
Haskell-Cafe
I have now read most of the notes on template-haskell2, but I still
have a problem with naming (although I think my issues with types
are adequately dealt with by the '' notation.
I wish to create a declaration in template haskell, where the funtion
name is supplied: something like:
$(label
Just reporting a bug, taking types using '' works fine for:
''Int
''[]
But when you try:
''(-)
you get:
No match in record selector TyCon.algTcRhs
Please report it as a compiler bug to [EMAIL PROTECTED],
or http://sourceforge.net/projects/ghc/.
you can do:
case 4 of n
| (n==3) || (n==4) - 99
Keean..
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
This is the interface I came up with (and its fairly efficient):
data IList a i e = ICons i i (a i e) (IList a i e) | INil
class List l e where
nil :: l e
null :: l e - Bool
head :: l e - e
tail :: l e - l e
(+:) :: e - l e - l e
class List (l a i) e = ListPlus l a i e where
Okay, maybe I misunderstood, I thought by stream
processors you meant functions of the type:
process :: [a] - [a]
where both the input and the output are lazy lists (streams)
I would assume if you want to have a stateful filter you need
to maintain the state by using either:
As posted on this list, there is template-haskell code to do:
$(derive [| data Foo = Foo |])
You can also get the type of Foo in TH by doing:
dummy :: Foo
dummy = undefined
$(derive2 dummy)
and the code for derive2 reify's the argument, which then gives the
reflected type... so the example
What replaces 'gensym' in GHC 6.3?
Keean.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Thanks for the URL... I have realised I jumped the gun saying the derivation can be
done in template-haskell... there is one small problem:
$(derive [t| SomeConstructor a b |])
passes the constructor to derive... is there any way to get the type information
for some type? You can do
$(derive
Check out Ulf Norell's IOHCC submission, his DeriveData.hs module does this,
Do you have a link?
Keean.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Although I still miss a simple primitive language construct to do
'extensible record',
If you look at the OOHaskell, and HList papers, you will see
the neatest way of defining an HList based extensible record
is:
record = label1 .=. value1
.*. label2 .=. value2
Have been playing with the idea of a list class like
the one I posted earlier... but now a bit streamlined.
I have implemented wc using this class and a nice buffer
list. The result is something 4 times slower than the
current language-shootout code, but is rather neater.
The restriction on
Of course when I say it's neater - I mean if the List class
were defined in the libraries, so only the short definition
of 'wc' given at the beginning of my last post would be required!
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
'extensible record' proposal.
HList is extensible records implemented in Haskell +
multi-parameter types and functional dependancies. In other words
you can already do all the recordy stuff in Haskell... HList
is simply a collection library using these techniques.
Haskell 98 does not have
What is the situation with deriving?
Some instances can be derived automatically for both data/newtype (built in)?
Some instances cen be derived automatically for newtype (any)?
You used to be able to define functions useing {|+|} and {|*|} (or similar)
that could be derived for both data and
look at the user manual.
Okay, I see the Generic type class stuff does not support multi
parameter type classes. I guess I am stuck - any suggestions as to
how best do this?
I wish to be able to derive type level labels for datatypes, like
the following:
data Fred a = Fred a deriving
You can only return a list of pair's lazily, not
a pair of lists. If the two strings are independant, then
generate each in a separate function, and pair off the
results lazily.
Keean.
___
Haskell mailing list
[EMAIL PROTECTED]
its almost commutative
Does that have something to do with splitting the supply?
newIORef
why not use 'newSTRef' and use the ST monad...
Keean.
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
addToSPairc ~(xs, ys) =3D (c:xs, ys)
I thought pattern bindings had an implicit ~?
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
addToSPair :: Char - (String, String) - (String, String)
What about:
addToSPair :: Char - String - String - (String,String)
so that the pattern match is:
addToSPair c xs ys = (c:xs,ys)
This is irrefutable?
Keean.
___
Haskell-Cafe mailing
All we really need is a 'unique value monad' to give us unique values
This sounds a lot like Clean's unique-types?
Keean.
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
One to add to your list, string edit distance - as its hard, and useful.
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
With reference to the discussion a couple of days ago
about list implementations, here is some code showing the
idea I was talking about... Its a list that you can write
either single elements or blocks (UArrays) to, but it always
reads like a list of elements, so blocks can be read in, but
you
Hows this:
...
tail (Many i a l)
| i (e-s) = (Many (i+1) a l)
| otherwise = l
where (s,e) = bounds a
...
a ++: l
| e = s = Many s a l
| otherwise = l
where (s,e) = bounds a
A futher though is that with constructors you can do:
f (a:as) =
class List l where
head :: IArray UArray a = l a - Maybe a
tail :: IArray UArray a = l a - Maybe (l a)
changed my mind about this... you cannot do: tail $ tail $ tail x
so added a 'null' test instead.
___
Haskell-Cafe mailing list
[EMAIL
No, you still have to copy so you can change the tail pointer
Do you? If is treated as a single buffer contents (IE implemented
as a UArray Int Char for example) then as our 'new' list implementation#
can have cells which are single elements of buffers of elements, we
simply 'cons' the
How is deriving coded in ghc. For example the Typeable class, when in
the compilation sequence is this expanded? Which modules do this, and
which functions?
Keean.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
lists doubly-linked and circular.
Erm, this just increases overhead, and file access is linear
anyway. Singly linked is good enough. What would make a difference
is if each 'node' in the listwas allowed to be larger that '1'
item. For example reading a file with 4k buffers, would work much better
- take this further and have list cells with 2 (or more) unboxed
characters, or even a full buffer.
This sounds like the best idea to me... with each list cell being a
full buffer you could effectively write nieve [Char] code and have it
implemented in about as fast a way as possible...
A
Doubly linked lists do not work very well in functional languages.#
when you have a list [1,2,3] and you prepend a value [9,1,2,3] the language
relies on the fact that the list tail [1,2,3] is not chainged by this operation.
This means the list can be prepended-in-place. With a doubly linked list
In general only specific *code* can be compiled more efficiently.
I disagree - If GHC optimised as much as is _possible_ the code would
be as fast and use as little memory as hand coded 'C'
It can't be transparent. A different type for semi-packed strings,
Again I disagree... I dont see why you
Well, the sootout itself is using GHC, as it lists both
language and implementation. There is no entry for NHC
or Hugs... So I would say if the GHC specific code is
neat and fast put it in... If people hant to see a NHC
then there should be a separate implentation of haskell
(for example I can
Also, its nice to see GHC ahead of Java now in the standard
results... Would be nice to beat OCaml Clean though ...
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
looking at ghc's scores... this would seem to be the next candidate for
a rework:
-- $Id: reversefile.ghc.html,v 1.6 2004/10/03 00:44:58 bfulgham Exp $
-- http://www.bagley.org/~doug/shootout/
-- from Julian Assange
main = interact $ unlines . reverse . lines
Compare this with the gcc
I though clean was always strict, and that was the major difference
between clean and haskell (that and the fact clean is a proprietry language)
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
what about, quote:
N.B. CleanLanguage is only available under a restrictive license. It's LGPL so long as
you're not selling anything you write. Otherwise you have to purchase a commercial
license. This probably means CleanLanguage will not survive long.
Keean.
results
Okay... read the license, seems whoever wrote that article on Clean
didn't read the license... You can use it under LGPL, for commercial
purposes... Still cant help thinking its yet-another-lazy-functional
language - I thought the whole point of Haskell was to stop prolifertion
I thought that you could use chained buffers to implement the lazy
lists, that way the top level interface would still be simple.
Also there should be an easy graph-rewrite operation that turns
your 3 sequential operations (in the wc example) into 3 parallel
ones...
put these two together in
1. Can exceptions be used in pure functions (outside of monads?)
Exceptions can be thrown from pure functions, and can be used exactly
like in the OCaml example (but in Haskell syntax)
Exceptions can only be caught in the IO monad.
2. How are these exceptions caught and handled aside from using
But, being able to see the context in which a thunk was constructed would be
extremely useful.
Yes of course... I was thinking along the lines of what is possible, rather
than what is desirable. If only ghc had a -g (debug) flag like gcc that would
force each funtion to push its entry onto some
Can this not be handled in a nicer way by the compiler? What if the
compiler tried to allocate the lists in chunks? For example when dealing
with strings, why cant the compiler allocate the string as a fixed length
unit, terminated with a link to the next unit. (IE allow the atoms in the
list to
Would it not bet better is String were a typeclass instead of a data type.
Then the string operations could be redefined by implementation, so you
may have strings as lists or strings as arrays?
Keean.
___
Haskell-Cafe mailing list
[EMAIL
You wouldn't want to have to accumulate the
entire body as a single byte string
Ever heard of lazyness? Haskell does it quite well... Accumulating
the entire body doesn't really do this because haskell is lazy. You
don't need a more complex interface in Haskell!
Keean.
E.g. what happens if you call getDirectoryContents for a directory
which contains filenames which aren't valid in the current encoding?
Surely this shows the problem with the idea of a 'current encoding'
... You could be reading files from two remote servers each using
different encodings...
So
In the general case, it needs to be a bit more complex than that,
Thats why the functions handled lists not individual characters,
I was assuming that each [Word8] - [Char] represented a valid
and complete encoding block... IE at the start of each call it
assumes no escapes. All this means is
CommandLineToArgvW provides a way to obtain a Unicode
Don't forget there are multiple encodings for unicode:
UTF-8, UTF-16, UTF-32...
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
My thoughts on I/O, binary and chars can be summerised:
1) Produce a new WordN based IO library.
2) Character strings cannot be separated from their encodings
(ie they must be encoded somehow - even if that encoding
is ascii). I would approch this using parameterised phantom
If I print out HsSyn types with pprTrace, I get:
test{v} () = id{v} ()
or something similar (depending on the declaration). Is there
any way I can get it to print out the raw data structure?
Keean.
___
Glasgow-haskell-users mailing list
[EMAIL
Would it cause me any problems if I added deriving Show to all the
types in compiler/hsSyn? (Can't think of a problem here... is there any
reason why this is not done by default? - It is really handy if trying to
pattern match on code syntax to be able to see what abstract syntax is
generated by
I have added some of the required deriving clauses, however I now
get lots of warnings about:
Bad eta expand
__coerce ()
(CmmParse.zgzg {- v rnrp -}
@ ()
@ ()
(__coerce CmmParse.ExtCode {- tc rB2 -} happyzuxzu1 {- v a1B9 -})
(__coerce CmmParse.ExtCode {- tc rB2
I need to change the boot .hi files for TypeRep, to include
the derivied show instance for TyThing, what is the format?
Keean.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Yes, it might be easier to elaborate the ppr instances... That
way I only have to modify instances I am interested in.
Keean.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Playing with HsSyn types (like HsModule)... I have got down to the
definition level like:
Sig id = Sig (Location name) (LHsDecl name)
what type is name? Presumably it can be a range of types,
what are valid types for name?
Keean.
___
When writing code in the compiler, how do you use pprTrace?
I want to print out the type of a SigD from HsDecl?
Keean.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
tryReadMVar mv = do mc - tryTakeMVar mv
The normal reason people want tryRead is to do something
like unix's 'select' function, where you want to wait on
one of several signals...
In my opinion it is better to do this with a _single_
channel and have one thread taking from the channel,
whilst
might be a reason to want to prefer one event over another.
You can still use a single channel... If you read all pending events on the
channel into a FIFO (lazy list) then you can check for high priority events
on read, and then deal with the next item on the top of the FIFO... something
like
I think you are confusing Dependent Types with Functional Dependencies.
Actually the two are not that dissimilar... If we allow types to depend
on types (which is what Functional Dependencies allow) IE:
class a b | a - b
instance Int Float
instance Float Int
For example
I thought symbolic processing was done in polynomial representation,
where the equation reduces to a matrix of coefficients that you operate
on, so not so symbolic at all...
Matlab tends to be one of the most used tools here (EEE at Imperial),
Maple and symbolic tools are only used a very
Matlab dynamically checks vector sizes... it does no static checking
as far as I know... I dont know about maple etc... but as I said,
matlab is the predominant tool in this area (at least in engineering)
I suspect maple may have more of a following amongst mathematicians.
Besides... Haskell can
I wish to add some extended syntax to type definitions,
assuming I modify the parser files and associated datatypes
to carry the extra information, is there a convenient place
to insert a pre-parse (before type-checking) to convert the
syntax extensions to regular haskell?
Keean.
Try type annotations:
new_point (s::s) t b : interleave (next_state s::s) bs (t:ts)
Keean.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
You will have to give both the errors and the source code...
I have done quite a bit with classes and GHC's constraint
inferance is pretty good.
The chances are you really do need to add some extra
constraints...
(by the way if you are working with heterogeneous collections,
you may be
You will have to give both the errors and the source code...
I have done quite a bit with classes and GHC's constraint
inferance is pretty good.
The chances are you really do need to add some extra
constraints...
(by the way if you are working with heterogeneous collections,
you may be
I thought NT and more recent was Posix compliant... Surely it should
support posix signals?
Keean.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
There is a portable System.Process library here:
On that note, perhaps all signals on unix should be
set to ignore, so if you are writing cross platform
code you don't have to do special stuff with say
sigPIPE for example
Keean.
___
See http://www.cwi.nl/~ralf/HList
for a paper which shows how to implement a heterogeneous list in haskell, and
how to implement operations on it (amongst other things)...
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
Yes, lazy type-class resolution is a known GHC feature - and in my
opinion much superior to Hugs stict type class resolution. Hugs
can get confused with overlapping instances and will choose the
wrong instance because it commits too early. GHC does not suffer
from this.
Keean.
If I wanted to experiment with instance selection, which part of
GHC do I want to be looking at?
Keean
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
just checked out the CVS ghc to play with instance
resolution - however:
fptools/mk/config.h.in
seems to be missing and nothing can be built.
Keean.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
In my view without that simple defining
rule it is difficult to come up with a proposal that is simple,
I think I have decided that it was not really closed world I was
thinking of, but more along the lines of what Simon PJ posted...
After all at some point the compiler _has_ to commit to an
Been having a bit of a discussion in the Cafe... Just wondered what
GHC specific issues would be involved with assuming all classes are closed.
I am thinking that there is no real dis-advantage to considering all
classes closed within their current context (IE all the imports to
the current
If the compiler treated instances as closed in this way, then adding a
new instance to the program could break existing parts of the program.
But there are many ways to do this... and besides this doesn't really make sense...
consider the following:
module A
defines class X
module B
Just a couple of quick points...
Why store the length along with the list, the length is stored
using type level naturals (Succ | Zero) but these are identical
to the recursion pattern in a List (Cons | Nil) - therefore it
is no less work than having a length function which converts
from one to
Actually the data statement wasnt quite right:
data Cons a b = Cons a b
Would work, but now there is nothing keeping each
element in the list as the same type,
I guess we could add a class to constrain to a normal list,,,
class List l x
instance List Nil x
instance List l x = List (Cons x l) x
This will only work for terminating programs!
Interesting point, but thats because all the operations are at
the type level - therefore if a type is unknown at compile time
we cannot produce a program.
With this type class stuff values can depend on types, but
not the other way around. You can
kind statements sound like a good idea - a couple of questions spring to
mind - what is the parameter of a kind statement (a type or a kind... a
kind makes more sense) ... do we have to stop with kinds what about
kinds of kinds - the statement has identical syntax to a data declaration,
is there
Is there any possibility of a theory that will avoid the need to replicate
features at higher and higher levels?
If we consider types, types are a collection of values, for example we could
consider Int to be:
data Int = One | Two | Three | Four ...
Okay, so the values in an integer are
After all, Java basically does exactly what you're asking for with
Java's head/tail would be doing runtime checks if they are throwing exceptions,
static guarantees mean the program would not be allowed to compile if it broke
the static guarantees.
end-programmers have to worry much less about
Not so. In Java, the programmer is forced to handle most exceptions
I forgot you had to do that... Exceptions are explicit in the type
signatures. I think Oleg posted a message a while back about how to
make exceptions explicit in haskell type signatures... But I would
rather use static
Static guarantees are great, but if you have to explicitly change your
style of coding to cope with those extra constraints, it can become (very)
cumbersome.
I had to change coding style moving from imperative to declarative languages,
but I think it was worth it... Likewise I think having the
You should include the definitions of the classes before saying
HOrderedList l' just has to prove by induction that for any element
in the list, the next element is greater, so the class is simply:
class HOrderedList l
instance HNil
instance HCons a HNil
instance (HOrderedList (HCons b l),HLe a
What can I say... Static typing guarantees is what made me switch from
object oriented languages like C++/ObjectiveC/Java (that and the availability
of a good compiler) - So I am obviously in favour of more static guarantees -
I believe programming by contract is the way to reliable _engineered_
specify that a sort function (say) returns an ordered list
Fistly this is already possible in Haskell - see Oleg, Ralf and
My paper:
@misc{KLS04,
author = Oleg Kiselyov and Ralf L{\a}mmel and Keean Schupke,
title = {Strongly typed heterogeneous collections},
booktitle = {ACM SIGPLAN Workshop
In most OO lanaguages I could use reflection to loop through my fields.
You could try a heterogeneous list, see:
http://homepages.cwi.nl/~ralf/HList/
Keean/
,.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
Introspection in Haskell is provided by the Data.Generics module.
The difference between the Data.Typeable and HList approach is that
Generics use run-time information to make choises, HLists use the
type system to make static guarantes. You can actually combine
the two quite nicely and end up
Yes, in principle. But that means you still need to write more and
tedious code to deal with it.
Just because code is tedious does not mean it is not necessary to
handle all corner cases. A robust application does not fail when
given unexpected input.
Are you going to discard lists in favor of
mins = map ((\(x:_)-x).sort)
maybe what you meant was:
case sort x of
(x:_) - ... do whatever with x ...
_ - ... do failure conition ...
As I said, if you can _guarantee_ non failure I guess head is okay, but the
fact that this thread started with the observation
No, I don't think so. I only want the bug to be reported
I think preventing the bug using the type system if possible is a good
idea... something that should be encouraged!
and not a corner case that should be handled.
So if the list depends on user input is not the empty list a corner
case
f (case xs of (x:_) - x; [] - error whoops) -- direct style
Yup, this is how I do it... I never use head!
I like to pass failures back up to the level where some kind of sensible
error message can be generated. In your example the error is no
better than with 'head' - the point is a Nothing
1 - 100 of 203 matches
Mail list logo