Table of Contents generated with DocToc
Table of Contents generated with DocToc
GHCVM has successfully accomplished the goals of Summer of Haskell:
- compile GHC 7.10.3's Haskell to Java bytecode
- access the vast Java ecosystem within Haskell
- port the base library
The initial proposal can be found here.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ConstraintKinds, DataKinds, TypeFamilies, UndecidableInstances, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, PolyKinds, TypeOperators, NoImplicitPrelude #-} | |
module Extends where | |
import Prelude hiding (Extends,Class,Object,Super) | |
data Object = Object | |
deriving Show | |
data Defined = Yes | No | |
type family Super (a :: *) :: * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mon Dec 12 17:15 2016 Time and Allocation Profiling Report (Final) | |
eta +RTS -p -RTS Main.hs | |
total time = 19.02 secs (19021 ticks @ 1000 us, 1 processor) | |
total alloc = 11,610,411,048 bytes (excludes profiling overheads) | |
COST CENTRE MODULE %time %alloc | |
sourceHandle.loop Data.Conduit.Binary 20.7 7.0 |
The file 2.jar
contains a file 2.class
that was generated manually (without javac
). You can download it here.
Running java -jar 2.jar
works perfectly and should output
Hello World!
Here is the output of running javap -c -v 2.class
:
Classfile 2.class
Rendering.hs:
{-# LANGUAGE FlexibleContexts #-}
module JavaFX.Rendering where
import Java
import JavaFX.Types
type Render a = Java GraphicsContext a
In https://github.com/rahulmutt/nofib, run using:
nofib-runner imaginary/queens --run --jmh="-wi 10 -i 10" --way="-O2"
Queens Solution:
-- !!! count the number of solutions to the "n queens" problem.
-- (grabbed from LML dist)
Replacing imaginary/queens
with the implemenation below in rahulmutt/nofib
:
{-# LANGUAGE BangPatterns #-}
-- solution by Oystein Kolsrud
-- https://www.youtube.com/watch?v=I2tMmsZC1ZU
okToAdd :: Int -> [Int] -> Bool
okToAdd q qs = all (okToAddDirection q qs) [succ, pred, id]
where
Hexdump of the corrupted jar:
00000000: 504b 0304 1400 0000 0800 4072 3c4a f0b8 PK........@r<J..
00000010: e8a0 7901 0000 8a02 0000 2000 1400 6768 ..y....... ...gh
00000020: 637a 6d70 7269 6d2f 6768 632f 4d61 6769 czmprim/ghc/Magi
00000030: 6324 696e 6c69 6e65 2e63 6c61 7373 0100 c$inline.class..
00000040: 1000 8a02 0000 0000 0000 7901 0000 0000 ..........y.....
00000050: 0000 7d91 4b4b c350 1085 cfd8 b469 637c ..}.KK.P.....ic|
00000060: b6b6 bedf 8fd6 8a51 5c2a 8214 8482 dda8 .......Q\*......
00000070: 745b aef5 1a83 691a 925b b0fe 2637 7551 t[....i..[..&7uQ
OlderNewer