-
Notifications
You must be signed in to change notification settings - Fork 145
Frequently Asked Questions
If it cannot be done with Java, then it cannot be done with Frege either. Otherwise, the answer is "most likely". Remember, writing Frege code is just a more convenient way to write Java code.
JDK7 is the official development platform, it is choosen because it has the fork/join packages which are used for parallelization.
However, apart from that, no Java 7 features are used. Hence, it is possible to compile and run frege programs that do not need paralellism with Java 6.
Here are the steps to follow, based on the "Re-Compiling the Compiler" section of the Getting Started page:
After cloning the frege repository, do the following adaptions:
-
In the
Makefile
, we letJAVAC
point to a java6 compiler and comment out the lines referringForkJoin.fr
,ForkJoin.class
-
In the
JAVA
macro, the property-Dfrege.javac
must also point to the java6 compiler. -
In
frege/runtime/CompilerSupport.java
, we need to remove references to theFiles
class and re-implement theslurp
method. The following one-liner could help with the importsimport java.util.Scanner
andimport java.io.File
:return new Scanner(new File(filename), encoding).useDelimiter("\\Z").next();
-
In
frege/runtime/Concurrent.java
, comment out thefork
method and references to ForkJoinPool. -
In
frege/StandardLibrary.fr
, theimport Lib.ForkJoin
needs to be removed. -
In
frege/runtime/Runtime.java
, replaceimport java.nio.charset.StandardCharsets
withjava.nio.charset.Charset
and replace the usage ofStandardCharsets.UTF_8
withCharset.forName("UTF-8")
. -
java.util.zip.ZipFile
implementsCloseable
only in Java 7 so we cannot callclose
throughCloseable
. Infrege/java/util/Zip.fr
, forZipFile
, add this functionnative close :: ZipFile -> IO () throws IOException
and infrege/frege/tools/Quick.fr
, replacej.close
incheckArch
function with(ZipFile.close j)
. -
Finally due to this bug in Java 6 compiler, you may not be able to compile Frege compiler sources with Java 6 compiler. In this case, you can cross compile to Java 6 using Java 7 compiler with
source
,target
andbootclasspath
options in yourfrege/Makefile
like:
JAVAC = javac -encoding UTF-8 -source 1.6 -target 1.6 -bootclasspath /your/path/to/jre-6/lib/rt.jar -extdirs "" -J-Xmx512m
JAVA = java -XX:+TieredCompilation "-Dfrege.javac=javac -encoding UTF-8 -source 1.6 -target 1.6 -bootclasspath /your/path/to/jre-6/lib/rt.jar -extdirs \\"\\" -J-Xmx512m"
Note that, in order to run the downloaded frege compiler, you still need at least JRE 7.
Home
News
Community
- Online Communities
- Frege Ecosystem
- Frege Day 2015
- Protocol
- Simon Peyton-Jones Transcript
- Talks
- Articles
- Books
- Courses
Documentation
- Getting Started
- Online REPL
- FAQ
- Language and API Reference
- Libraries
- Language Interoperability
- Calling Frege From Java (old)
- Calling Java From Frege
- Calling Frege From Java (new)
- Compiler Manpage
- Source Code Doc
- Contributing
- System Properties
- License
- IDE Support
- Eclipse
- Intellij
- VS Code and Language Server
- Haskell
- Differences
- GHC Options vs Frege
- Learn You A Haskell Adaptations
- Official Doc
Downloads