22
Adventures with Extreme Types in a Purely Functional Language FregeFX: Pure Functions and Explicit Effects for JavaFX JavaOne 2016

FregeFX - JavaFX with Frege, a Haskell for the JVM

Embed Size (px)

Citation preview

Adventures with Extreme Types in a Purely Functional Language

FregeFX: Pure Functions andExplicit Effects for JavaFXJavaOne 2016

Dierk König canoo

mittie

Frege is a Haskell for the JVM

Extreme Typespurefunctionscannotproduceaneffect

butwehaveto!

->produceactionsthattellwhattodo(likearecipe)

actionsareofaspecialtype,e.g.IOactionsorJFXactions

Extreme Typesmakeimplicitconstraintsexplicit

JavaFX:onlytouchnodesinsideUIthreadonlydoIOoutsideUIthread

Lesstrickyerrors

Developer Discipline

Pure Functional Language

Constrained Context

Enforced by CompilerLesstricky

errors

pure native encode java.net.URLEncoder.encode :: String -> String encode “Dierk König“

native println System.out.println :: String -> IO () println “Dierk König“ native getText :: TextInputControl -> JFX String text <- inputField.getText println text - - does not compile! inIO text println - - compiles!

Native Declarations

Entry Points IThe github projecthttps://github.com/Frege/FregeFX

The tutorial that uses FregeFX to build a cover-flow galleryhttps://github.com/Dierk/fregeTutorial

FregeChat, client written in FregeFXhttps://github.com/Dierk/FregeChat

Entry Points IIGui of the Frege REPL, written in FregeFXhttps://github.com/Dierk/frepl-gui

some videos- https://www.youtube.com/watch?v=pxKJ_KPLml- https://www.youtube.com/watch?v=9V7w-RSC_1A

Unique in FregeGlobal type inference (requires purity)Purity by default effects are explicit in the type systemType-safe concurrency & parallelismLaziness by defaultValues are always immutable Guarantees extend into Java calls

Why Frege

it is just a pleasure to work with

How?http://www.frege-lang.org@fregelangstackoverflow „frege“ tagedX FP101 MOOC

Dierk König canoo

mittie

Please give feedback!