Spring '14
As of now, there will be just one downloadable file in a release. This is, of course, the frege jar.
All documentation is now kept on http://www.frege-lang.org
- Runtime Javadoc
- Frege Library (I am still looking for a nice way to have a searchable page, or at least an automatic index on http://www.frege-lang.org/doc/frege. Contributions and ideas welcome!).
- Language Reference
The eclipse plugin has now an upgrade site. The library sources are part of the compiler jar, and so mouse over+ctrl+click navigation to library code is always possible.
This release has the following enhancements:
- Quickcheck 2.6 ported from Haskell
- Quick, a tool to run Quickcheck properties of a module, or several modules. (If you try this on the fregec.jar, there will be 2 failing tests. No worries!)
- better documentation, especially for overloaded native functions
- native array support via JArray
- better Unicode support in the scanner, who used to ignore surrogate pairs. Also, everything that is not explicitly uppercase is treated as lowercase, as far as Frege is concerned. This means, you can now write variable names in scripts that do not have case (like Devanagari). Caveat: the scanner still does not recognize glyphs, that is, if I have a german keyboard, I can enter
ä
and it will beU+00E4 LATIN SMALL LETTER A WITH DIAERESIS
, which is a letter and hence acceptable in identifiers, but if one enters the canonical decompositionä
U+0061 LATIN SMALL LETTER A + U+0308 COMBINING DIAERESIS
it won't be recognized as identifier part, becasue the scanner still operates on single unicode points, and the diaresis is not a letter, but a non-spacing mark. Arguably, improvements are possible here. - Regex literals also are more Unicode-ish, they are being compiled with UNICODE_CASE; CANON_EQ and UNICODE_CHARACTER_CLASS flags.
- fixed a bunch of issues
- made the compiled code faster (and, unfortunately, at the same time bigger)
- added a head-strict cons operator
(!:)
. This means that inx+3 !: ys
, for example,x+3
is evaluated right away, whileys
is still lazy. List comprehension uses this, which often results in better code with less laziness overhead. If one needs to allow for undefined elements in the list, one must use map or the list monad. - the type unsafe special native return type
[a]
is no longer recognized. Use JArray to tell Frege that a Java method returns an array. - cleaned up the handling of let bound functions. Until now, local functions that did not reference any local name from their outer scope were silently moved to the top level. This often resulted in more general types, though this is seldom necessary. From now on, if you want your local function to have a polymorphic type, you need to annotate it or write it as top level function right away. Unannotated let bound functions are thus never generalised by the type checker, which brings more consistency and often better code. Still, if the function doesn't use local variables from the enclosing scope, it might get moved to the top level so as to avoid inner classes. This is now also documented in the language reference and the "Differences to Haskell".
main
can now have typeIO a
or[String] -> IO a
for some typea
. Ifa
is not (), you need to annotate it, though. If the fregemain
function returnsIO Int
orIO Bool
and if it is run through the suppliedstatic void main(String args)
java method (i.e. as command line application), the returned value will be used to determine the exit status, where0
ortrue
signal success. If main is not annotated and doesn't look like a function, it is assumed to beIO ()
. Otherwise, if it has arguments,[String] -> IO ()
is assumed, as before.- implemented several convenience functions of Haskell heritage:
on
,interact
,readFile
,writeFile
,appendFile
,getContents
and, as substitute for Haskell'shGetContent
we havegetContentsOf
which operates on a Reader. - improved type directed name resolution (TDNR). This means, that expressions of the form
x.m
wherex
is an expression andm
is an identifier, will always (I hope!) be typeable, whenever the type ofx
can be determined at all. The non-globalised lets contribute here because there is more code where the type ofx
may get disclosed, but the algorithm I used up to now also had a flaw that prevented proper typing in some cases. The better TDNR also applies to the other syntactic forms that trigger it:x.{m?}
x.{m=v}
andx.{m<-f}