2,853 karma · joined January 10, 2011
https://github.com/emillon/
http://blog.emillon.org/
@etiennemillon
me @ <username> . orgHey, who said that static typing caught all bugs ? :)
I don't think that list comprehensions are very idiomatic in Haskell, one would probably use Data.List.partition instead:
qsort [] = []
qsort (p:xs) = low ++ [p] ++ high
where (low, high) = partition (< p) xsI can't imagine a single application where you would need to preserve the value of hashed format strings. But specifying their value so that you can rely on them just seems to be a bad idea.
<div id="fucking_intro_video_wrapper">
<video id="fucking_intro_video">
Classy!Form aside, this looks like a very interesting product, as others I wanted to work on something similar too. Good luck!
0 is also a special case litteral for the null pointer, and function names are valid in pointer contexts, so I'm not even sure that "f == 0" is badly typed.
The fact that this model works well on dead-tree newspapers, does not mean that it should be copied on the internet. We have tools to customize how sites are displayed, ads shouldn't be a sacred exception.
I've been wanting to do something like this for a certain time, so I have a few questions if you don't mind.
How do you handle authentication? Tokens? Cookies? Is there a special "API key" for your web app?
git add -p
git stash
test
commit
git stash popThere are a lot of tutorials like this one, but I think that they mostly help the writer (not that it's a bad thing).
import Data.IORef
main :: IO ()
main = do
r <- newIORef []
writeIORef r ["Hello"]
x <- readIORef r
print $ x + 1
return ()
The reference is bound by "r <-", ie a lambda (as this desugars to ">>= \ r ->"), and lambdas are never generalized (even in ocaml).I think that the reason why it works is that because there is no way to let-bind r except with a toplevel unsafePerformIO.
berlin='env TZ=Europe/Berlin date' let r = ref []
Here r has type 'a list ref (reference to a list of 'a where 'a is unknown). r := ["hello"]
r has type 'a list ref, := has type 'a ref -> 'a -> unit, and ["hello"] has type string list, so it works (if we instantiate 'a with string). let n = 1 + (List.head !r)
1 has type int, + has type int -> int -> int, and we can type (List.head !r) as int since we can type !r as int list since we can type r as int ref list (this time instantiating 'a by int).So, we just added an int and a string and the program will probably crash. What's wrong is that every line is correct but because of the mutable store, the program as a whole is incorrectly typed.
The solution is to generalize only a subset of all syntactic constructs. The historic solution in Ocaml is to never generalize expressions that may allocate memory (that's the "value restriction") . For example, a function application (like f x, or ref []) may allocate, but a variable or a constant (like x or 1 or []) can not. That's why [] has type 'a list but ref [] has type '_a list ref ('_a can be unified only once, so in the above example an error would occur at the "let n").
ie for every github project you get a project mailing list to discuss development on a higher level than individual bug reports.