Skip to content

Instantly share code, notes, and snippets.

@tfausak
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfausak/015eeee5cb4332037347 to your computer and use it in GitHub Desktop.
Save tfausak/015eeee5cb4332037347 to your computer and use it in GitHub Desktop.

Frege

https://github.com/frege/frege
https://github.com/Frege/frege/wiki/Differences-between-Frege-and-Haskell

  • imports are nicer
    • import Foo as Foo (Foo) in particular
  • differences in prelude are annoying
  • also syntactic differences get annoying when porting code
    • every module has to start with module Foo where
    • no deriving stuff, instead separate derive Class Record statements
  • standard library is mostly all there
  • lack of read is killer
    • also floor and ceiling
      • these are in Prelude.Math
  • basically no libraries
  • couldn't figure out how to find documentation for standard library
  • no website, package site, documentation site, or build tool
    • website exists, but redirects to github
    • works fine with lein (and maven and ant, but i haven't tested those)
    • basically "no hackage"
  • records are way better
    • namespaced, so can have multiple per module
    • easy to read, write, and update
    • no lenses required!
  • string escape sequences are different
    • "\ESC" -> "\u001b"
  • string isn't [Char], which gets annoying
    • feels like String should really be Text
    • especially considering packed/unpacked
  • distributing an uberjar is nice
    • but so is distributing an executable
  • hard to tell if build times are bad, considering JVM startup time
  • java interop is probably about as nice as it could be
  • repl is a separate project entirely
    • that being said, fx repl is pretty cool
  • doc comments part of grammar
    • --- and {--
  • booleans are lowercase
  • multi-arg lambas are more annoying
    • \x \y -> (x, y)
    • understandable, since that's really a shortcut for \x -> \y -> (x, y)
  • @ behaves differently
    • f x@(y:ys) is now f (x@(y:ys))
  • public vs private is handled with private modifier instead of export list
    • i like this
    • i don't like how you have to mark both the type and implementation as private
      • private f :: a -> b; private f x = ...
@Dierk
Copy link

Dierk commented Jun 25, 2015

If you allow, a few observations from my side.

basically no libraries

I'd add .. "unless the ones you get for Java - but those are subject to native declaration."
(and QuickCheck comes bundled)

build tool, dependency management

There is (lein, maven, gradle, IDE) support for building and dependency management builds
on the Java strategy for this, which is hugely successful (much more so than hackage, cabal, stack, etc.)

string isn't [Char]

yes, this tipped me off as well in the beginning, but having the Java String type is huge for integration. Also, there rarely is a need to pack/unpack since your can do things like head "Hello".

java interop

it is "a bit" of a pain, I agree, but nevertheless the compelling advantage of Frege since it keeps the language clean. The pain comes from exposing the messiness of most Java APIs. When the doctor tells you that you are ill, it is not the doctor's fault that you are ill.

fx repl is pretty cool

thanks :-)

doc comments

are even cooler, since you see them immediately in the REPLs and in the IDE Plugin when you ask for the type (without explicitly invoking the doc tool)

Thanks for the thorough analysis!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment