Andrzej Jaworski wrote:
Good direction.
Perhaps you can also figure out how to replace the disturbing $ operator?
Something out of Unicode?
≬⊳⌁⋆☕⚡‣‸‡⁏•△▴◆◇◊◬◢◮♘♣♲♪◖▻▿轢
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe
David House wrote:
I see this a lot. My personal preference is:
mylist =
[ foo, bar, baz,
qux, quux, foo,
bar, baz, qux ]
Or,
mylist = [foo, bar , baz,
qux, quux, foo,
bar, baz , qux]
___
Haskell-Cafe
http://www.cs.chalmers.se/~nad/publications/danielsson-lic.pdf
Total Functional Programming
http://www.jucs.org/jucs_10_7/total_functional_programming/jucs_10_07_0751_0768_turner.pdf
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
?
mapTuple :: ((a - b) ^ (c - d)) - (a,c) - (b,d)
http://www.cs.cmu.edu/~rwh/theses/pierce.pdf
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
` (qualified variable operator)
conop -consym | `conid ` (constructor operator)
qconop -gconsym | `qconid ` (qualified constructor operator)
...I've also thought it would be nice to be able to say things like...
(foo `liftM2 (,)` bar)
Greg Buchholz
Steve Schafer wrote:
Here's the essence of the problem. If I have this:
process1 x y =
let u = foo x y;
v = bar u;
w = baz v
in w
I can easily rewrite it in point-free style:
process1 = baz . bar . foo
Not unless you have a much fancier version of
Conal Elliott wrote:
Warning: I haven't tried to type-check and may have made a clerical error.
Since questionCategories isn't used, use fst eliminate another let.
Then, for my personal preference, and just to mix things up, switch to
where style:
process item mediaKind mediaSize language
Joshua Ball wrote:
Here is how I am trying to solve the problem, using multi-parameter
type classes.
class NPProblem inst cert where
validates :: cert - inst - Bool
certificates :: inst - [cert]
decide :: inst - Bool
decide i = any (\x - x `validates` i) $ certificates i
) = (roundDDec d c :+ roundDDec d b)
roundDDec :: (RealFloat a) = Int - a - a
roundDDec d a = a -- or somegthing
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
isto wrote:
] I've been trying to compile the following function
] (rounding to a desired degree):
]
] roundDec :: (Num a, Typeable a) = Int - a - a
] roundDec d a =
] let t = show (typeOf a)
] in case t of
] Double - roundDDec d a
] Complex Double -
a.
(m a) - a) (m (m b)) b'
...I can't say I'm surprised, but I was wondering if anyone else has
thoughts on how this limitation might be worked around.
Curious,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe
[EMAIL PROTECTED] wrote:
Greg Buchholz has posed an interesting problem of writing a
typechecker. Given untyped terms of the form
...snip...
We show the solution that uses no GADTs and no representation types.
We retain however the eval function in the previous message that uses
GADT. Our
= undefined
...you'll get an error message like...
The equation(s) for `foo' have three arguments,
but its type `[a] - a - r' has only two
YMMV,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman
Rearranging...
Nicolas Frisby wrote:
On 10/31/06, Greg Buchholz [EMAIL PROTECTED] wrote:
...That first article is the strangest. I couldn't reconcile the fact
that if our type signature specifies two arguments, we can pattern
match on three arguments in the function definition
- Int
baz 0 = (+)
baz 1 x = succ
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
that make any sense?).
I'm curious if there could be a small change to the type system to
make the fully general my_read possible, or if it suffers from an
incurable defect.
Thanks,
Greg Buchholz
{-# OPTIONS -fglasgow-exts #-}
main = print test
test :: Int
)
(EIsZ (ELit 42)))::Term Int)
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
x
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
In order for the first case to work as you expect, you'd need the type
foo :: Integer - (a::Type, Show a, a)
which is traditionally written
foo :: Integer - (exists a. Show a = a)
I thought exists was spelled forall in Haskell?
Greg Buchholz
, a)), or somesuch. Any thoughts on how to get this to work?
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
of main and square to
help nudge me in the right direction. (I'm using ghc-6.6)
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
[EMAIL PROTECTED] wrote:
]
] One way is to use existentials:
]
data Seq1 a = forall b. (Pre a b, Show b) = Cons1 a (Seq1 b) | Nil1
]
] which perhaps not entirely satisfactory because we have to specify all
] the needed classes in the definition of Seq1.
Yes, that seems pretty
are interesting solutions!
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
this to work.
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Spencer Janssen wrote:
] Here's an attempt with GADTs:
]
] \begin{code}
] {-# OPTIONS_GHC -fglasgow-exts #-}
] data Succ a
] data Zero
] data Seq a b where
] Cons :: a - Seq a b - Seq a (Succ b)
] Nil :: Seq a Zero
] \end{code}
]
] Seems to work for me.
Hmm. Maybe I'm missing
Casey Hawthorne wrote:
The Q Programming Language can do the following:
sqr X = X*X
==sqr 5
25
==sqr (X+1)
(X+1)*(X+1)
Can Haskell do symbolic manipulation?
Typeful symbolic differentiation of compiled functions
Jared Warren wrote:
Haskell's type checking language is a logical programming language.
The canonical logical language is Prolog.
Why can't Haskell (with extensions) do type-level Peano naturals in
the same fashion? The code would be something like:
Also of possible interest, _Fun with
4.3.2 of the Haskell Report (at least by
my reading).
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
the parser combinators from the Hutton and Meijer paper to
perl...
http://sleepingsquirrel.org/monads/parser/monad_parser.txt
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell
in a language like C.
http://www.gnu.org/software/libc/manual/html_node/Allocation-Debugging.html
http://perens.com/FreeSoftware/ElectricFence/
http://valgrind.org/
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
- d) - Twist a c - Twist b d
data Twist a b = Nil | Cons a (Twist b a) deriving Show
x = (Cons foo (Cons 1 (Cons bar (Cons 2 Nil
tmap :: (a-b,c-d) - Twist a c - Twist b d
tmap _ Nil = Nil
tmap (f,g) (Cons x rest) = Cons (f x) (tmap (g,f) rest)
Thanks,
Greg Buchholz
Christophe Poucet wrote:
The idea however is that MonoType is going to be used in a recursive
way. For instance:
newtype FMT = FMT MonoType FMT
instance FMT where...
Er, I'll ignore this part.
And this definition will have to reside on recursive definitions. In the
style of how
Christophe Poucet wrote:
I'm not certain but I think this will still fail for exactly the piece that
you ignored, which is the crux of the problem.
-- You're not looking for this solution, right?
import List
type Var = String
type Const = String
data MonoType mt = TyVar Var
Brandon Moore wrote:
I don't quite understand the problem, but maybe an example involving an
explicit recursion operator will help.
-- Maybe he's looking for something like...
{-# OPTIONS -fglasgow-exts #-}
{-# OPTIONS -fallow-undecidable-instances #-}
import List
type Var = String
type
Christophe Poucet wrote:
What I would like to do is combine HasVars and Type (mostly because in my
framework the two concepts shouldn't be divided from a design perspective)
into one type class to clean it up a bit. However I fail to see how I would
implement toType and fromType for the given
) :- not(isfuncwithhead(C,A)).
isfuncwithhead(A=B,A).
...Now I just need to figure out how to represent not without cut.
I'll take a look at what Oleg has done.
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org
Robert Dockins wrote:
] In the second instance, what you really want to say is instance c [a]
] c, only where c is not an application of (-). As I recall, there is
] a way to express such type equality/unequality using typeclasses, but
] I don't remember how to do it offhand.
For those
extentsion and possibly the source code of the implementation?
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Aditya Siram wrote:
] I am trying to write a function 'applyArguments' which takes a
] function and a list and recursively uses element each in the list as
] an argument to the function. I want to do this for any function taking
] any number of arguments.
]
] applyArgument f (arg) = f arg
]
Apply, then the types (a-b), b, and (a,c) are
-- also a member, so keep going...
instance Apply a b c = Apply (a-b) b (a,c) where
app f (x,rest) = app (f x) rest
g w x y z = w*x + y*z
args = (1,(2,(3,(4,Nil
main = print $ app g args
Greg Buchholz
Greg Buchholz wrote:
instance Apply a b c = Apply (a-b) b (a,c) where
Whoops, instead of that, I think I meant...
instance Apply (b-c) c d = Apply (a-b-c) (b-c) (a,d) where
...where we strip off one layer of types, because of the recursion. Of
course, that still doesn't work though.
Greg
Gerhard Navratil wrote:
I need a library that provides partial derivatives for functions. The
solution I came up with is based on a datatype using reversed polish
notation to store the function:
I like Oleg Kiselyov's Typeful symbolic differentiation of compiled
functions...
, but where did g come
from? Is this is the internal definition of not? And does this loss
of referential transparency contaminate the rest of the language, or is
this superShow just an anomaly?
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell
in...
*Main main
(Var y)+(Const (2.0))
(Var y)+(Const (1.0))+(Const (1.0))
...is this competely unrelated?
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
else 0,
m+if g elem then elem else 0 ) ) (0,0) xs
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
FWIW, (not much), I asked a similar questions over on the
Lambda-the-Ultimate blog a while back...
http://lambda-the-ultimate.org/node/923
http://lambda-the-ultimate.org/node/485
...Anyway, I can't help but think that there might be a happy medium
between eager and lazy evaluation.
Greg
like the resulting Maybeified
program, you can get the original functionality back by changing the
type signature to use the Identity monad instead of Maybe.
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org
. I guess I'll be brushing up on my typeclass-fu in order
to figure out how all this works.
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
. I guess I'll be brushing up on my typeclass-fu in order
to figure out how all this works.
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
= map
instance Funct a = Funct [a] where
f_map f = map (f_map f)
main = print $ fmap (+1) [[[1,2,3]]]
...but maybe it gets the idea across?
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman
],
a = b, b c, a*a + b*b == c*c ]
...See also...
http://www.haskell.org/onlinereport/lexemes.html#lexemes-layout
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
You might also like to try the slightly more efficient...
pyth n = [(a,b,c) | a - [1..n],
b - [a..n],
c - [a+1..n],
a*a + b*b == c*c ]
Greg Buchholz
___
Haskell-Cafe
?
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
| State a deriving (Show, Eq)
...Does it give better error messages at compile time or something?
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org
Ralf Lammel wrote:
What you can do is define a dedicated *type code* for composition.
comp = hFoldr (undefined::Comp) (id::Int - Int) test
data Comp
instance Apply Comp (x - y,y - z) (x - z)
where
apply _ (f,g) = g . f
That does it!
Thanks,
Greg Buchholz
) - (a - b) - a - c)
...into (a - c), or something else altogether. I figured someone might
be able to help point me in the right direction.
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo
interesting functions that
could be defined? Is there a better way define these functions? Is
there anything other than curiosity which would motivate someone to use
these functions?
FWIW,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe
with the functions f and g besides just
the boring old composition (like maybe skipping the execution of g if
f fails, or allowing backtracking, or something more bizarre and
clever). And what should we name this new super composition operator?
= maybe? Ah...
Greg Buchholz
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
and
_Imperative functional programming_.
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
-legged animals with an exoskeleton.
...which tells us a lot more about the fundamental nature of insects.
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
?
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
? Is it more convienient for
compiler/specification writers this way? Is it just because that's the
way its always been done?
Curious,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
checker after all).
Confused,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
? No. I've never
written a Haskell compiler, but I'd say it sounds like it might be a
tedious book-keeping problem though.
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
.
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
want to retarget ti so that Haskell is generated, or rewrite the
generator in Haskell? (Or both?)
Maybe not completely related, but you might find this paper interesting...
http://lambda-the-ultimate.org/node/view/652
Greg Buchholz
___
Haskell
Dmitry Vyal wrote:
Hello everybody.
I have a long list consisted of a small number (about a dozen) of
elements repeating in random pattern. I know all the possible elements.
I need to count number of occurences of each particular element and to
do i quickly.
For example
quick_func
Dmitry Vyal wrote:
By the way, how to use Unboxed arrays and unsafeAccumArray Greg Buchholz
mentioned? I can't find them in GHC 6.2 documentation.
http://www.haskell.org/~simonmar/haddock-example/Data.Array.Base.html
Greg Buchholz
___
Haskell
be interested in hOp:
hOp is a micro-kernel based on the RTS of GHC. It is meant to
enable people to experiment with writing device drivers in Haskell.
http://www.macs.hw.ac.uk/~sebc/hOp/
or maybe House...
http://www.cse.ogi.edu/~hallgren/House/
Greg Buchholz
Keean Schupke wrote:
The things to notice are using types as instance labels, that constraints
form horn clause compile time meta-programs (in a non-backtracking prolog
style) and that multi-parameter classes with functional depandencies simulate
some dependant types.
I think I
Keean Schupke wrote:
Haskell is not dependantly typed, so cannot deal with types that depend on
values.
Can anyone recommend a nice dependently typed language to play with?
Cayenne, Epigram, other?
Greg Buchholz
___
Haskell-Cafe mailing list
(which would imply it was possible to statically
type). Well, it wasn't quite as direct as I had initially thought, but
it looks like you've done it. Are there any papers/books out there
which I could study to learn more about these (and other) tricks of the
type system wizards?
Thanks,
Greg
, HTypeIndexed, GhcRecord,
Record, HZip, HOccurs, HArray, HListPrelude, FakePrelude.
Looks to me like a very similar error to the tuple case.
Greg Buchholz
--Joy combinators in Haskell
{-# OPTIONS -fglasgow-exts #-}
{-# OPTIONS -fallow-overlapping-instances #-}
import MainGhcGeneric1
import
Daniel Fischer wrote:
Am Freitag, 4. M?rz 2005 19:35 schrieb Greg Buchholz:
So, can anyone direct me towards more information on exactly
what an Occurs check is, or does anyone see an easy fix to my
problems?
If I remember correctly, an occurs check is checking whether a type
variable
might
work, only in better words.
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
check is, or does anyone see an easy fix to my
problems?
Thanks,
Greg Buchholz
P.S. The first thing you should note about the code below is the
definition of the reverse composition operator (!), which I used to give
the program a more Joy-like feel. (i.e. (!) f g = g.f)
--Joy combinators
, sh) - parse_text shape_parse input
I'm probably missing something silly. Any hint would be appreciated.
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Mike Gunter wrote:
I'd guess that
let (cam, sh) = parse_text shape_parse input
is what you want? (Completely untested ...)
Yep. That did it.
Thanks,
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
://zoo.cs.yale.edu/classes/cs490/03-04b/bartholomew.robinson/
...although still a research project, it takes a more functional
approach to GUI's.
Greg Buchholz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
chokes without increasing the stack, while my copy of GHC 6.2.1 runs
the program below quite fine, even without enabling optimizations.
Greg Buchholz
--Floating point PostScript version of Sierpinkski Carpet
fillSquare x y s = putStr $ x1 ++ y2 ++
x1 ++ y1
(camel) and _Perl_Cookbook_ (ram)?
I suppose I should stop being lazy and contribute to the Haskell
version of the PLEAC project...
http://pleac.sourceforge.net/
Greg Buchholz
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org
are
superior: in efficiency; in ease of programming; in more predictable
resource utilization and avoidance of resource leaks. We present a
design of the overall optimal collection traversal interface, which is
based on a left-fold-like combinator with premature termination.
Greg Buchholz
Moments
Process Instantiation
Reverse A File
Ring of Messages
Count Lines/Words/Chars
Word Frequency
Greg Buchholz
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Robert Dockins wrote:
BTW can you give some references to these known techniques?
See also, Purely Functional Data Structures by Chris Okasaki for
functional implementations of queues, dequeues, etc.
www-2.cs.cmu.edu/~rwh/theses/okasaki.pdf
Greg Buchholz
-ilmenau.de/~robertw/dessy/fun/democratic/
Greg Buchholz
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
(concat $ replicate (read n) keys)
putStrLn $ unwords $ map show [get hash1 foo_1,
get hash1 foo_,
get res foo_1,
get res foo_]
Thanks,
Greg Buchholz
bytes per MUT second
Productivity 57.7% of total user, 51.7% of total elapsed
Greg Buchholz
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
of the test and gnu/wc)
perl-5.8.4 0.535s
gcc-3.4.2 0.102s
gnu/wc 0.435s
Greg Buchholz
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
time 74.2% (70.8% elapsed)
Alloc rate388,122,622 bytes per MUT second
Productivity 25.8% of total user, 25.1% of total elapsed
Greg Buchholz
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
Haskell style
application. If someone (not haskeller) looks at the implementation it
should be very obvious and clear.
It might also be nice if the code would run under the other haskell
compliers like Hugs and nhc98 right out-of-the-box.
Greg Buchholz
_Foundations of Mathematical Logic_?
Greg Buchholz
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
(=) and the small arrow (-). This
is the most general type you could make for this particular function and
allows you to mix amd match arguments like...
square(3, 4)
square(3.14, 4)
square(2.718, 6.022)
etc.
Greg Buchholz
___
Haskell-Cafe mailing list
[EMAIL PROTECTED
93 matches
Mail list logo