Looking for papers/resources/keywords on JIT, supercompilation etc. and their applicability on GHC/Haskell
I'm wondering about possible compile-time and runtime optimization techniques that we can apply to Haskell/GHC. I knew JITs for a long time and recently learned about supercompilation in one of the posts in this subreddit. The paper in the link showed great results but those are not applied to GHC(I think a subset of Haskell is implemented from scratch for demonstration).
I was wondering (apart from requiring huge amounts of work) what are problems with applying those techniques to Haskell. I'm looking for papers about those techniques in Haskell context, and papers of similar techniques. Can anyone point me some papers/resources/keywords about those?
Thanks.submitted by semanticistZombie
[link] [6 comments]
Instead of an OS where everything is deemed a noun (the file) even if a function or dynamic stream, perhaps go the other way where the standard atomic unit of reference is the function. Everything is a function, of course all functions can be the input of some other function.
Directories could be replaced with categories and data types removing the need for the kludged alias. File names need not be used, each file is given a UID or UUID name, the latter being perhaps a hash function, which would mean non destructive data editing. OS processes and src functions can also be named via a hash scheme, and thus referenced by hash in the actual source code (with local human readable aliases). Instead of foo() where foo can change, referencing some hash may be advantageous—any function can self regulate for consistency.
Just some naive thoughts.submitted by lstwhl
[link] [29 comments]
This morning I've finally had some time to start learning Haskell, and after only a few minutes, I've encountered a few aspects of the language that have left me baffled. FYI, I have a small amount of FP experience (light exposure to Clojure, but I make extensive use of procs/lambdas in Ruby and Python).
First, why can't we use prefix notation for built-in functions? If ++, !! and the like are functions, why is:list1 ++ list2
valid syntax while++ list1 list2
Why is it that prepending an item to a list with the cons operator is fast, but appending requires traversal of the entire list? As a corollary, why isn't there an equivalent to:"THIS IS A LIS":'T'
I understand that this isn't valid because the first argument to the cons function is an element, and the second is a list. I'm just curious as to why there is no built-in append function.
Why does list comparison return a scalar instead of a list? But more importantly, why on Earth does this expression evaluate to True?[3,4,2] > [3,4]
Supposedly, list comparison operates in lexicographical order. 3 > 3 is clearly false, as is 4 > 4. The only thing left is to compare element 3 of the first list to...what?[3,4] !! 2
isn't a valid expression, so( [3,4,2] !! 2 ) > ( [3,4] !! 2 )
shouldn't evaluate to True, unless I'm missing something here.
Are there logical explanations for these behaviors?submitted by jakeytrojan
[link] [13 comments]
The book he uses is from 2007, the lectures themselves from 2009. Are they still useful for a beginner or has Haskell changed too much?submitted by minipump
[link] [17 comments]
Consider this:data D1 a = MkD1 a type family TF a :: * data D2 a = MkD2 (TF a)
Then GHC deduces this (I think), because type roles:instance (Coercible a b) => Coercible (D1 a) (D1 b) instance Coercible (D2 a) (D2 a)
But what I really want is this:instance (Coercible (TF a) (TF b)) => Coercible (D2 a) (D2 b)
This would be sound, would it not?submitted by AshleyYakeley
[link] [5 comments]
So I have to create an infinite list of list of "subsets" from a small string input
for example, I have allSets str = ....
str being "ab"
So the result would be
[[""], ["a", "b"], ["aa", "ab", "ba", "bb"], ["aaa", "aab", "aba", "abb", "baa", "bab", "bba", "bbb"], ["aaaa", .....]]
I had an idea of using something similar to nats where we create an infinite list, but I couldn't quite think of a waysubmitted by seps427
[link] [5 comments]
I have the following implementation of foldl using foldr:myFoldl :: (a -> b -> a) -> a -> [b] -> a myFoldl f base xs = foldr scan id xs base where --scan :: b -> (a -> a) -> a -> a scan b g x = g (f x b)
What is the type of scan?
The above code will compile and works as expected, however, if I uncomment the type declaration for scan, then the code does not compile. I used a type hole and GHC told me that the commented out type decleration is the correct type for scan, so I guess a secondary question is why was GHC wrong when I was using the type hole?submitted by Buttons840
[link] [4 comments]