Evan Laforge has defined
> data Thing {
> thing_id :: ThingId
> , thing_stuff :: Stuff
> }
> newtype ThingId = ThingId String
and wishes to statically preclude binary operations with things that
have different ThingIds. However, Things and their Ids can be loaded
from files and so cannot be
ACM SIGPLAN 2012 Workshop on Partial Evaluation and Program Manipulation
http://www.program-transformation.org/PEPM12
January 23-24, 2012. Philadelphia, PA, USA (co-located with POPL'12)
Second Call For Participation
Program is now available
http://www.program-transformation.or
Bulat Ziganshin wrote:
the following code can't go through typechecking
> import Control.Monad.ST
> import Data.Array.ST
> main = print $ runST $
>do arr <- newArray (1,10) 127
> a <- readArray arr 1
> writeArray arr 1 216
> b <- readArray arr
a list, we
are not given the pointer to the ``current list''. We are merely given
the current element of the list. Perhaps the following links might be
of help:
http://www.eros-os.org/pipermail/e-lang/2004-March/009643.html
http://pobox.com/~oleg/ftp/Haskell/misc.html#fold-stre
Krasimir Angelov wrote:
> There are three active database libraries: HDBC, HSQL and Takusen.
> It is quite disappointing from my point of view. Recently there was
> the same situation with the GUI libraires.
I think the dichotomy between lower-level Haskell libraries (whose API
is closer/faithfu
A good explanation is in Section `1. Eigenvariables and generic reasoning'
of
@inproceedings{MillerTiu,
author= {Dale Miller and
Alwen Fernanto Tiu},
title = {A Proof Theory for Generic Judgments: An extended abstract},
booktitle = {LICS},
year = {2003},
page
Bill Wood wrote:
> is |nabla x, nabla y. phi(x,y)| logically equivalent to
> |forall x, forall y. x <> y only-if phi(x,y)|? I use |P only-if Q| for
> |P materially implies Q|
First of all, I should remark that Miller and Tiu introduce two
calculi (with names that are hardly speakable, even in Te
Simon Marlow wrote:
> I suggest you follow the same scheme as the unboxed array types, and
> have IOURef/STURef types, parameterised over the element type. Of
> course, we should have instances for all of the primitive numeric types
> plus Ptr, ForeignPtr, StablePtr, Bool.
Perhaps it may be wort
Martin Sulzmann wrote:
> - The type functions are obviously terminating, e.g.
> type T [a] = [[a]] clearly terminates.
> - It's the devious interaction between instances/superclasss
> and type function which causes the type class program
> not to terminate.
>
> Is there a possible fix? Here
> Let's consider the general case (which I didn't describe in my earlier
> email).
>
> In case we have an n-ary type function T (or (n+1)-ary type class
> constraint T) the conditions says for each
>
> type T t1 ... tn = t
>
> (or rule T t1 ... tn x ==> t)
>
> then rank(ti) > rank(t) for each i=1,
Martin Sulzmann wrote:
> Let's consider the general case (which I didn't describe in my earlier
> email).
> In case we have an n-ary type function T (or (n+1)-ary type class
> constraint T) the conditions says for each
>
> type T t1 ... tn = t
>
> (or rule T t1 ... tn x ==> t)
>
> then rank(ti) >
Greg Buchholz wrote:
> Is it possible to make a typeclass like Functor, that has a function
> (say "f_map"), which would work for the infinite hierarchy of types:
> ([],[[]],[[[]]],...)?
You do understand that this requires overlapping instances? Because
the type [[Bool]] is still a list. In
Daniel McAllansmith wrote:
> When I try to add MonadError into the types I eventually hit the
> requirement for allow-undecidable-instances. Is there some way I can
> I avoid having to use this extension?
>
> class (Num i, Bounded i, Monad m, MonadError String m)
> => MonadSource i m | m
Creighton Hogg wrote:
> No instance for (MatrixProduct a (Vec b) c)
> arising from use of `<*>' at :1:3-5
> Probable fix: add an instance declaration for (MatrixProduct a
> (Vec b) c)
> In the definition of `it': it = 10 <*> (vector 10 ([0 .. 9]))
Let us look at the instanc
> But I am still confused by the exact definition of coherence in the case of
> overlapping. Does the standard coherence theorem apply? If yes, how?
> If no, is there a theorem?
Yes, the is, by Martin Sulzmann et al, the Theory of overloading (the
journal version)
http://www.comp.nus.edu.
It seems that the subject is a bit more complex, and one can force GHC
to choose the less specific instance (if one confuses GHC well
enough): see the example below.
First of all, the inequality constraint is already achievable in
Haskell now: "TypeEq t1 t2 False" is such a constraint. One can
wr
Creighton Hogg posed the following problem. Given a rather
straightforward matrix multiplication code
> -- The elements and the size
> data Vec a = Vec (Array Int a) Int deriving (Show,Eq)
> type Matrix a = (Vec (Vec a))
> class MatrixProduct a b c | a b -> c where
> (<*>) :: a -> b -> c
> in
Robert Dockins wrote:
> One additional (very unfortunate) point is that higher-order IO monad
> combinators will not work on your monad, eg, the ones in
> Control.Exception.
Although that is true in general, for many useful and interesting
cases (including ReaderT, the state transformer, and the
error ``no instance (LabelOK ScopeC ScopeB)'' -- which seems clear.
The more elaborate version of similar example can be found here:
http://pobox.com/~oleg/ftp/Haskell/types.html#monadic-regions
Using labels to enforce well-formedness term constraints (content
model constrain
David Roundy wrote:
> class Commutable a b d c
>
> commute :: Commutable a b d c =>
> (Patch a b, Patch b c) -> (Patch a d, Patch d c)
>
> But for this to work properly, I'd need to guarantee that
>
> 1. if (Commutable a b d c) then (Commutable a d b c)
>
> 2. for a given three types (a
David Roundy wrote:
> data CommuteResult a b c where
> CR :: C a b c d => (P a d, P d c) -> CommuteResult a b c
> ...
> or that somehow GADTs aren't interacting with FDs as I'd like
It must be emphasized that there are *NO* GADTs is the above code.
Except Stefan Monnier's message, no code pos
Jeff Harper defined typeclasses
> class Reciprocate a b | a -> b where
> recip :: a -> b
> class Multiply a b c | a b -> c where
> (*) :: a -> b -> c
and encountered the problem with
> -- Here I define a default (/) operator that uses the
> -- Reciprocate and Multiply class to perform
Recently Vo Minh Thu wondered if Haskell (or, I generalize, functional
programming) can be of much use for computer graphics programming.
I'd like to point out a project that experimentally shown that
functional programming is of great help for processing of large raster
images (24-bit PPM files)
I'm afraid the _meta_ programming aspect of the image processing
project may be overlooked.
Joel Reymont wrote:
> I think the issue wasn't using functional programming for large image
> processing, it was using Haskell. OCaml is notoriously fast and
> strict. Haskell/GHC is... lazy.
Well, i
. And then we examine f and g to see what we've got
and how to proceed from that. At that point, it's us who decides what
to improve first. The idea is similar to the one described in
http://pobox.com/~oleg/ftp/Haskell/types.html#is-function-type
The complete code follows. Now test
Most systems of (first-order) logic differentiate between function
letters (aka, symbols) and predicate letters (symbols). The former are
used to build terms; the latter build atomic formulas (which can later
be combined in more complex formulas using negation, conjunction,
disjunction, and quanti
y are
explained in
http://pobox.com/~oleg/ftp/Haskell/typecast.html
Incidentally, that web page's source also gives an illustration of their
use:
http://pobox.com/~oleg/ftp/Haskell/typecast.hs
The page itself is written in HSXML, which had to deal with a similar
problem
Sorry for a late reply, I'm out of town.
As I understand it, the problem is as follows: we'd like to construct
different realizations of XML documents from data of different
types. We wish to write
p (p "foo")
and specify the desired type of the XML document, like
(p (p "foo")) :: X
packed strings, general recursion
and creative index expressions) can be handled. Again, without
introducing any runtime overhead:
http://pobox.com/~oleg/ftp/Haskell/KMP-deptype.hs
The approach is formalizable; the recent PLPV talk by Chung-chieh Shan
presented the types systems and the pr
of TypeCast that works within the
same module, please see any code described in
http://pobox.com/~oleg/ftp/Haskell/typecast.html
Appendix D of the full HList paper (or, HList technical report, I
should say) gives the reasons for TypeCast.
Briefly, TypeCast lets us replace a (ground) type T
This message is intended as a long answer to Michael Shulman's
question (Re: variadic functions and typeCast) and Jason Dagit's
question (Re: Duplicate Instance problem). Incidentally, the short
answer to Jason Dagit's question is `constraints are disregarded
during instance selection'. The answer
Jason Dagit wrote:
> I tried to create a type class for making instances of Show display a
> custom way. After using my class for a while I found that sometimes
> RealFloats would display as 'NaN' and this is unacceptable. So at
> this point I had something like:
>
> class Show a => StringValue
I previously wrote:
> The typechecker commits to the instance
> and adds to the current constraints
> TypeCast x Int, Ord Bool, Eq Bool
> The latter two are obviously satisfied and so discharged. The former
> leads to the substitution {x->Int}.
I should have been more precise and said:
It seems that irrefutable pattern match with existentials is safe. The
fact that irrefutable pattern match with GADT is unsafe has been
demonstrated back in September 2004.
Let us consider the following regular existential data type
> data TFoo where
>Foo :: Show a => a -> TFoo
>Bar :: I
I have come to realize that irrefutable pattern matching of
existentials may indeed be problematic. Let us consider the following
existential data type
> data FE = forall a. Typeable a => Foo a
> | forall a. Typeable a => Bar a
The following tests type and run (the latter raising the exp
> I wanted to try using OOHaskell as a library, but I've run into some
> problems I don't understand.
> I downloaded the copy from:
> http://homepages.cwi.nl/~ralf/OOHaskell/
both HList and OOHaskell are now available via DARCS
http://darcs.haskell.org/HList/
http://darcs.haskell.
> I am using a heterogenous list as in [1] all elements of which are of
> a given class C.
> Since foo maps all class members to Int, hMapOut should be a
> straight-forward way to produce homogenous Int lists from heterogenous
> CLists:
>
> test :: (CList l) => l -> [Int]
> test = hMapOut foo
Wel
Matthias Fischmann wrote:
> instance (Monad m, HSequence m HNil HNil) => HSequence m HNil HNil
> where hSequence _ = return HNil
>
> how can i use the goal of the declaration as one of the conditions
> without causing some sort of black hole in the type inference
> algorithm?
Very easily: th
constrained to be in the decreasing, increasing,
or any other (defined in the future) order. This example shows that
Haskell truly has more kinds than it is commonly acknowledged.
For more details on constrained lists (list of odd numerals, even
numerals, etc), please see the following implementat
I too miss the old way of handling local type variables. Previously,
local type annotations worked a lot like an additional constraint,
with type variables denoting some type. The same type variable denoted
the same type. Here's how it works in OCaml, for example:
# let pair x y = (x,y);;
val pai
Tim Smith wrote:
> Has anyone found out how to lift bracket into another monad?
Yes, please see the thread `Re: Control.Exceptions and MonadIO'
staring at
http://www.haskell.org/pipermail/haskell-cafe/2006-April/015444.html
There is also a Haskell' ticket:
http://hackage.haskell.org/t
The problem seems equivalent to the following:
http://pobox.com/~oleg/ftp/Haskell/typecast.html#local-fd
That is, the inferred type is too general to chose the appropriate
instance. The solution is also the same: either add type annotations
to restrict the inferred type (and so make it
Greg Buchholz has posed an interesting problem of writing a
typechecker. Given untyped terms of the form
> data Expr = ELit Int
> | EInc Expr
> | EIsZ Expr
we are to compute typed terms:
> data Term a where
> Lit :: Int -> Term Int
> Inc :: Term In
Donald Bruce Stewart wrote:
> So all this talk of locating head [] and fromJust failures got me
> thinking:
>
> Couldn't we just use rewrite rules to rewrite *transparently*
> all uses of fromJust to safeFromJust, tagging the call site
> with a location?
I'm sorry for shifting the top
loop l accum = indeedFL l accum $
>(\l -> loop (tail l) (head l : accum))
>
> test1 = safe_reverse [1,2,3]
As we can see, the null test is algorithmic. After we've done it, head
and tail no longer need to check for null list. Those head and tail
functi
Jan-Willem Maessen wrote:
> In addition, we have this rather nice assembly of functions which
> work on ordinary lists. Sadly, rewriting them all to also work on
> NonEmptyList or MySpecialInvariantList is a nontrivial task.
That's an excellent question. Indeed, let us assume we have a func
Malcolm Wallace wrote:
> and since you cannot write a partial signature,
Can't we really?
It seems `partial signature' means one of two things:
- we wish to add an extra constraint to the type of the function
but we don't wish to explicitly write the type of the
func
Simon Peyton-Jones wrote:
> kind HNat = HZero | HSucc HNat
>
> class HNatC (a::HNat)
>
> instance HNatC HZero
> instance HNatC n => HNatC (HSucc n)
>
> There is no way to construct a value of type HZero, or (HSucc HZero);
> these are simply phantom types. ... A mer
context of Scheme,
is available here:
http://pobox.com/~oleg/ftp/Scheme/io.txt
More polished drafts exist, and even a prototype
implementation. Unfortunately, once it became clear that the ideas are
working out, the motivation fizzled.
The discussion of i18n i/o highlighted the need for general
Andrew Pimlott wrote:
> I want values in my existential type to denote, for some monad, a
> monadic operation and a way to run the monad. Except, I want it mix
> the operation with operations in another monad, so it use a monad
> transformer.
I'm afraid, that phrase was a little misleading. It s
I added two lines to your code:
iterate2 f x n | seq f $ seq x $ seq n $ False = undefined
iterate2 f x n = --- as before
rk4Next f h (x, y) | seq f $ seq h $ seq x $ seq y $ False = undefined
rk4Next f h (x, y) = -- as before
I also increased ten times the number of steps for the last iteratio
Tom Pledger wrote:
> Something along these lines:
>
> class List l a | l -> a where
> nil :: l
> cons :: a -> l -> l
>
> But that's not of much use, because there isn't a class method to
> recover the elements of a List. We could add more methods (corresponding
> to null, head
> > data Bar a m = forall t. (MonadTrans t, Monad (t m)) =>
> > Bar (t m a -> m a) (t m Int)
> > data Foo = Foo (forall a m. Monad m => Bar a m)
>
> Is it true that I cannot have a function
>
> foo run op = Foo (Bar run op)
I guess the answer is yes and no. Let's consider the ty
Simon Marlow wrote:
> I've been wondering whether having a more synchronous kind of
> finalizer would be a good thing.
Hans Boehm in his POPL2003 paper "Destructors, Finalizers, and
Synchronization" persuasively argued that finalizers _must_ be
asynchronous. That assertion is the title of Section
Simon Peyton-Jones wrote:
> In GHC at present, a separate type signature introduces no scoping. For
> example:
> f :: forall a. a -> a
> f x = (x::a)
> would be rejected, because the type signature for 'f' does not make
> anything scope over the right-hand side, so (x::a) means (x
Jules Bean wrote:
> From the point of view of a programmer, that's all there is to it:
> there is no way of proving two functions are the same except by
> exhaustively checking every input.
That is too pessimistic, I'm afraid. There is also an intensional
equality. Granted, it can be sound but
The operator ($) is often considered an application operator of a
lower precedence. Modulo precedence, there seem to be no difference
between ($) and `the white space', and so one can quickly get used to
treat these operators as being semantically the same. However, they
are not the same in all ci
Ashley Yakeley wrote on the first day of 2005:
> This compiled with today's CVS GHC 6.3. I don't think you can do this
> without GADTs.
It seems we can do without GADT -- roughly with the same syntax
(actually, the syntax of expressions is identical -- types differ and
we have to write `signature
class. OTH, if we place the handlers in a HList, and use the OOHaskell
encoding, we can probably arrive at open (extensible) GADT.
The complete new code is included.
> Where now? Well, counterexample fiends who want to provoke Oleg into
> inventing a new recipe had better write down a higher-or
On Sun, 2 Jan 2005 [EMAIL PROTECTED] wrote:
> I tried to generalize one of my old
> packages for quantum *abstract* computations, where state vectors are
> defined as functional objects, whose codomain has some arithmetic.
> It is easy to see that you can define (f <+> g) = \x -> f x + g x
> etc.
Andrew Bromage wrote:
<<
-- WARNING: This code is untested under GHC HEAD
data State s a
= Bind :: State s a -> (a -> State s b) -> State s b
| Return :: a -> State s a
| Get :: State s s
| Put :: s -> State s ()
instance Monad (State s) where
(>>=) = Bind
return = Return
insta
the categorical product. The second example is
taken from
http://pobox.com/~oleg/ftp/Haskell/categorical-maxn.lhs
which has the following comment about that code fragment:
The constraints in the prod's type are intricately related. The final
expression for prod bears some similarity with Un
This message is a literate Haskell98 code for translating proper
linear combinators into a point-free style. That is, we will be
converting (closed, albeit that is not strictly a requirement) terms
of the form ``\x1 ... xn -> term'' where each variable xi has at most
one occurrence in term. The te
Bryce Bockman wrote:
> How would you guys memoize the following code.
>
> simpleCalc :: (Int,Int) -> (Int,Int)
> simpleCalc (1,l) = (1,l+1)
> simpleCalc (x,l) | (odd x) = simpleCalc (((3*x) + 1), 1 + l)
> | otherwise = simpleCalc ((x `div` 2), 1 + l)
>
> sCalc x = simpleCalc (x,
Benjamin Pierce wrote:
> For someone coming to Haskell from an OCaml background, one of the hardest
> things to get used to is the somewhat more bare bones module system that
> Haskell provides.
> ...
> This works fine as long as what you're exporting is just values, but it's
> awkward for types,
Samuel Bronson wrote:
> I was trying my hand at writing some collection classes myself and I
> can't figure out a good typing for map that will let me make Map an
> instance of my Collection class...
> I don't much like the head of Mapping.
How about the following:
> class Collection (d k e) (k
> This also doesn't seem like it would work very well with making an
> instance for IntMap.
> I guess I can't have everything.
It is not that difficult to make instances for IntMap:
> data TypeCast k IM.Key => WIM k e = WIM (IM.IntMap e) deriving Show
>
> instance Collection (WIM IM.Key e) (IM.K
Alistair Bayley wrote:
> There's a small problem: how to write a factory function that returns values
> of various subtypes. The makeSubType function below won't compile, obviously
> because the returns types are different (they're not the same 'm').
Indeed, expressions in both branches of an `i
utStrLn "finish")
Delimited continuations are really cool.
The lack of the answer-type polymorphism in ContT will come to bite us in
the end: we can't use reset several times in differently-typed
contexts (which often means that we can use reset only once in our
program). The CC monad t
Daniel Brown wrote:
>class Baz a b | a -> b
>instance Baz (a -> b) (a -> [b])
>instance Baz a a
> ...but Baz fails with this error...
>
> When confronted with overlapping instances, the compiler chooses the
> most specific one (if it is unique), e.g. `Baz (a -> b) (a -> [b])` is
> mor
he paper specifically made a point that msplit
can be defined without help from recursive data types. The brief
summary of that derivation is a note `How to take a TAIL of a
functional stream'
http://pobox.com/~oleg/ftp/Computation/Continuations.html#cdr-fstream
The higher-rank ty
Regarding the law of mif (aka ifte, aka soft-cut, aka logical
conditional)
mif (mif c t' e') t e = mif c (\x -> mif (t' x) t e) (mif e' t e)
You're right of course: mode matters for the predicates that involve
negation, such as mif. However, I believe that the mode is orthogonal
to the disc
Jonathan Cast wrote:
] > You can't define most initial models without recursive (or
] > inductive) data types in general, because initial models are defined
] > inductively.
] > You can't define head, tail, or foldr using the MonadPlus
] > signature
] OK. Right. I forgot about the Church en
On Thu, Jul 07, 2005 at 07:08:23PM +0200, Tomasz Zielonka wrote:
> Some time ago I wanted to return the escape continuation out of the
> callCC block, like this:
>
> getCC = callCC (\c -> return c)
It seems using shift/reset is better not only in principle but in
practice as well.
> module Foo
For
example,
http://pobox.com/~oleg/ftp/Computation/monads.html#fair-bt-stream
First of all, the monad can let succeed the computations that surely
diverge in List and similar monads. As the code at the end of that
file shows, the monad avoids depth-first traps, and can even handle
left-r
Also inspired by Ralf Hinze's post, I thought of removing GADTs from
that code. The result is Haskell98! code, which works well in
Hugs. The code seems to be a bit simpler too. Like the original code,
the function 'parseAny' correctly discriminates between the list of
characters (i.e., strings) an
Conor McBride wrote:
> Inspired by Ralf's post, I thought I'd just GADTize a dependently typed
> program I wrote in 2001.
Equally inspired, I thought of deGADTizing that code. The code below
also uses no existentials, and no local type annotations. The code is
more general in that the parser wor
Conor McBride wrote:
> Neither Oleg nor Bruno translated my code; they threw away my
> structurally recursive on-the-fly automaton and wrote combinator parsers
> instead. That's why there's no existential, etc. The suggestion that
> removing the GADT simplifies th
Conor McBride wrote:
> Neither Oleg nor Bruno translated my code; they threw away my
> structurally recursive on-the-fly automaton and wrote combinator parsers
> instead. That's why there's no existential, etc. The suggestion that
> removing the GADT simplifies th
Ralf Hinze wrote:
> To me replacing a GADT by class and instance declarations seems the
> wrong way round. We should not forget that the DT in GADT stands for
> `data type'.
Francois Pottier enumerated some problems with type inference of GADT
code during his ICFP'05 invited talk. Various extensi
Tomasz Zielonka wrote:
> Speaking about casts, I was playing with using GADTs to create a
> non-extensible version of Data.Typeable and Data.Dynamic.
> I wonder if it's possible to write such a thing without GADTs (and
> unsafeCoerce, which is used in Data.Dynamic, IIRC).
Absolutely. Stephanie W
similar model, I could inspire
> myself on? (I know a few theoretical works on that).
Yes, of course: the code for the LogicT paper
http://pobox.com/~oleg/ftp/packages/LogicT.tar.gz
(please see SFKT.hs) and
http://www.haskell.org/pipermail/haskell/2005-October/016577.html
http://
John Meacham wrote:
> data Type = ForAll [TyVar] Rho -- Forall type
> | FunType Type -- Function type
> | TyCon TyCon -- Type constants
> | TyVar TyVar -- Always bound by a ForAll
> with the three synonyms and their constraints being
David Roundy wrote:
] The basic idea is that a patch will have type (Patch a b) where "a" and "b"
] are phantom types. Sequential patches will have identical ending and
] beginning types. So that a sequential pair, for example, can be written as
]
] data Sequential a c where
] Sequential ::
Stefan Monnier wrote:
> I expected at first you were doing some funky type class molestation
> so you can use "djinn" in your code and let Haskell fill it in.
That has already been done:
De-typechecker: converting from a type to a term
http://www.haskell.org/pipermail/haskell/2005-March/015423.h
t (x y z ...), x is not an appl and not an abst
; It is equivalent to ((x y) z ...)
; Try to reduce y, z, etc. separately
Eval (x y . rest) -> (A x (Map Eval (y . rest)))
; The topmost is (x) -- remove the extra parens
Eval (term) -> Eval term
E
[redirected to haskell-cafe]
Jón Fairbairn wrote:
> 1. Why "-f" anyway? It took me ages to work out what
> "-fallow-overlapping-instances" meant -- I wondered how
> "fallow" could apply to overlapping instances.
I believe the authors of GHC followed the naming conventions
of GCC, which can be g
Hello!
The other day I received, among other junk mail, coupons for the local
7-eleven store. I subconsciously scanned the envelope, and almost
jumped when I read the return address:
7-Eleven, Inc.
2711 North Haskell Avenue
Dallas, TX 75204
It seems a rather long Avenue
[Moved to Haskell-Cafe]
Hello!
Cycles sure make it difficult to transform graphs in a pure non-strict
language. Cycles in a source graph require us to devise a way to mark
traversed nodes -- however we cannot mutate nodes and cannot even
compare nodes with a generic ('derived') equality operato
> Leon Smith wrote:
> >On Friday 16 August 2002 23:57, Scott J. wrote:
> >runST :: forall a ( forall s ST s a) -> a ?
> >
> >In logic forall x forall y statement(x.y) is equivalent to:
> > forall y forall x statement(x,y).
> Now, using a different argument, since "s" does not appear free on
>
There is another solution to the problem of configurational
parameters. The main part of the solution is portable, does not depend
on any pragmas, does not use unsafe operations, does not use implicit
parameters, and does not require any modifications to the user code. I
must warn that it is also
Deforestation is usually defined as the elimination of an intermediate
data structure between a single producer and a single consumer. Jorge
Adriano showed an interesting example of one producer feeding two
independent consumers. The two streams of data are mutually
dependent. Furthermore, the rat
David J. Sankel wrote:
> I was referring to a haskell interpreter to be used
> within haskell code. For instance:
> main = do
> user_configuration <- parseHaskell
> title <- resolveFunction user_configuration "title"
> :: String
> putStr title
This was exactly the gist of the message:
ht
Lauri Alanko wrote on Dec 22:
> The magic is _here_:
> (begin (define a 5) (eval '(set! a (+ a 1)) (interaction-environment)) a)
> ==> 6
> Here (interaction-enviroment) is a run-time representation of the
> compile-time environment. It makes possible two-way interaction between the
> stages. Ess
Richard Uhtenwoldt wrote:
> (2) the global variable has a lexical scope that extends over
> the bulk of the program.
> It strikes me as a simple and obvious application of lexical
> scope, and I am surprised that it received no mention in the
> discussions on this list and in Hughes's paper.
Som
Cagdas Ozgenc wrote:
> Is it possible to encode an array using lamda terms only, and recover
> the term specified by an index term in O(1) time?
I'd like to go on a limb and argue that there is generally no such
thing as O(1) array access operation. On the conventional hardware,
the fastest acce
| comb is only called from here:
| sumbn n = sum [ bernoulli i * fromIntegral(comb (n+1) i) | i
| <- [0 .. n-1] ]
Probably I misunderstand what "bernoulli i" stands for. If it is meant
Bernoulli number B_i,
http://mathworld.wolfram.com/BernoulliNumber.html
then the above expression is qu
> Oleg's blew the heap at 847; mine valiantly struggled on 'til it blew
> the heap at 1910.
Hmm, I managed to compute bernoulli 2000 and even bernoulli 3000. The
code is included. It took 7 minutes (2GHZ Pentium IV, 1GB memory) to
compute bernoulli 2000 and 33 minutes for bernoulli 3000. I monito
Hi
Is it possible to redefine methods in a subclass (not an instance)? E.g. I get
errors in
class (Show a) => Employee a where
speak :: a -> [Char]
speak x = "Employee: " ++ (show x)
class (Employee a) => Manager a where
speak x = "Manager: &q
The following seems to be a faster version of powerset that delivers
results strictly in the order of increasing cardinality (i.e., all
sets of size 1 first, then of size 2, etc). It seems to run faster
than any other ordered version of powerset posted so far. On GHCi,
length $ powerset [1..22] is
301 - 400 of 429 matches
Mail list logo