From luminance-0.1 to luminance-0.2 included, it was not possible to use any texture types different than two-dimensional textures. This blog entry tags the new release, luminance-0.3, which adds support for several kinds of texture.A bit more dimensions
Basically, textures are now fully polymorphic and are constrained by a typeclass: Texture. That typeclass enables ad hoc polymorphism. It is then possible to add more texture types without having to change the interface, which is cool. Like everything else in luminance, you just have to ask the typesystem which kind of texture you want, and everything will be taken care of for you.
Basically, you have three functions to know:
- createTexture, which is used to create a new texture ;
- uploadSub, used to upload texels to a subpart of the texture ;
- fillSub, used to fill – clear – a subpart of the texture with a given value.
All those functions work on (Texture t) => t, so it will work with all kinds of texture.Cubemaps
Cubemaps are also included. They work like other textures but add the concept of faces. Feel free to dig in the documentation for further details.What’s next?
I need to find a way to wrap texture arrays, which are very nice and useful for layered rendering. After that, I’ll try to expose the change to the framebuffers so that we can create framebuffers with cubemaps or that kind of cool feature.
In the waiting, have a good a week!
I've been asked by our students to do a small Haskell workshop, lasting 4 hours.
Students from the 1st to the last semesters have enrolled.
What I have prepared so far:
- Solved the first 10 problems of 99 Haskell problems.
- Used clash to generate some verilog
- Created (copied from a tutorial) a few yesod examples.
This, I think is a lot of content, for beginners and advanced users.
What I looking for now is an evangelical speech. Can some point me an YouTube video from a Haskell evangelist? :)
Also, is there another neat Haskell use I should bring about?
I was thinking of showing a parallel quicksort, for instance.
Edit: Is there a way to package an android app really quickly?
Edit2: I also added a scripting example, using System.Processsubmitted by anarcap
[link] [31 comments]
This year the runtime for the Go language, which is slightly similar to Haskell's (lightweight threads that can be multiplexed across OS threads, garbage collection), was moved over entirely to Go (and a little assembly). Since Haskell seems to have similar performance characteristics to Go, are there any theoretical reasons (ignoring practical concerns like manpower) why the Haskell runtime could not be written entirely in Haskell?
[link] [47 comments]
I hope this is useful. I dont know how to comment it.example :: InterpolationPoints Double example = [(0,1),(1,2),(7,50)] main = putStrLn.showPolynomial$ polynomialFor example type Polynomial coefficients = [coefficients] type InterpolationPoints a = [(a,a)] polynomialFor :: Fractional a => InterpolationPoints a -> Polynomial a polynomialFor  =  polynomialFor points@(_:xs) = a:polynomialFor (map(\(x,y)->(x,y-a*x^e) ) xs) where a = leadingCoefficient points e = length xs leadingCoefficient :: Fractional a => InterpolationPoints a -> a leadingCoefficient [(_,y)] = y leadingCoefficient (a:b:ps) = (leadingCoefficient(a:ps)-leadingCoefficient(b:ps))/(x a - x b) where x (a,_) = a showPolynomial :: (Eq a , Num a , Show a) => Polynomial a -> String showPolynomial  = "0" showPolynomial (0:xs) = showPolynomial xs showPolynomial (x:xs) = s (length xs) ++ " + "++ showPolynomial xs where s 0 = show x s 1 = show x++"x" s n = show x++"x^"++show n submitted by Florian939
[link] [5 comments]
I have to test if three numbers are not the same.
So I made this code :threeDifferent :: Integer -> Integer -> Integer -> Bool threeDifferent x y z = not (( x == y ) && ( x == z) && ( y == z))
Now I want to use quickCheck to test this one.
So I begin with the case the three numbers are the same.prop_threeDifferent x x x
but how can I tell quickCheck to check only for 3 equal numbers ?submitted by rwobben
[link] [11 comments]
Just thought I'd share a neat trick that I came across today:(iover imapped .) (iover imapped .) :: ... => (i -> j -> a -> b) -> f (g a) -> f (g b)
Example:(iover imapped .) (iover imapped .) (\i j v -> 3*i + 1+j + v) [[0,0,0],[0,0,0],[0,0,0]] = [[1,2,3],[4,5,6],[7,8,9]]
Generalizing:((iover imapped.).) ((iover imapped.).) ((iover imapped.).) (\i j k v ->) (((iover imapped.).).) (((iover imapped.).).) (((iover imapped.).).) (((iover imapped.).).) (\i j k l v ->)
Basically, the additional composition dots come from the fact that the (iover imapped) need to wait for the indexed function to curry over yet another index value.submitted by haskellStudent
[link] [5 comments]
I try to learn haskell by reading and doing the exercises of the craft 3 edition book.
But am I the only one who trouble understanding what it's expected from the exercises. Sometimes I reading and asking a whole afternoon for help so I can understand what the exercise exaclty is.
and is there a way to overcome this problemsubmitted by rwobben
[link] [7 comments]
Now, not even environmental friendliness is an excuse to not be on top of the most recent functional research developments!
Repository is over at https://github.com/beerendlauwers/haskell-papers-ereader.
I've also added most papers in Oliver Charles' repository a few weeks ago.
NOTE: If you'd like a paper added, please report an issue :)submitted by beerendlauwers
[link] [3 comments]