PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Frege

Frege

Frege is a pl created in 2011.

#174on PLDB 11Years Old 4.4kUsers
0Books 0Papers 223Repos

Frege is a non-strict, purely functional programming language for the Java virtual machine in the spirit of Haskell. It is considered a Haskell dialect or simply "a" Haskell for the Java virtual machine. Frege has a strong static type system with type inference. Read more on Wikipedia...


Example from Linguist:
{-- This program displays the current time on stdandard output every other second. -} module examples.CommandLineClock where data Date = native java.util.Date where native new :: () -> IO (MutableIO Date) -- new Date() native toString :: Mutable s Date -> ST s String -- d.toString() --- 'IO' action to give us the current time as 'String' current :: IO String current = do d <- Date.new () d.toString {- "java.lang.Thread.sleep" takes a "long" and returns nothing, but may throw an InterruptedException. This is without doubt an IO action. public static void sleep(long millis) throws InterruptedException Encoded in Frege: - argument type long Long - result void () - does IO IO () - throws ... throws .... -} -- .... defined in frege.java.Lang -- native sleep java.lang.Thread.sleep :: Long -> IO () throws InterruptedException main args = forever do current >>= print print "\r" stdout.flush Thread.sleep 999
Example from Wikipedia:
{-- This program displays the current time on standard output every other second. -} module examples.CommandLineClock where data Date = native java.util.Date where native new :: () -> IO (MutableIO Date) -- new Date() native toString :: Mutable s Date -> ST s String -- d.toString() --- 'IO' action to give us the current time as 'String' current :: IO String current = do d <- Date.new () -- reads system timer, hence IO d.toString main args = forever do current >>= print -- print formatted date print "\r" -- followed by carriage return stdout.flush -- make sure it's shown Thread.sleep 999L -- wait 0.999 seconds

Language features

Feature Supported Example Token
MultiLine Comments
{- A comment
-}
{- -}
Comments
-- A comment
Line Comments
-- A comment
--
Semantic Indentation ϴ
agda.html · frege.html · ballerina.html

View source

PLDB - Build the next great programming language · v2022 · Day 32 · Docs · Build · Acknowledgements · Traffic Today · Traffic Trends · Mirrors · GitHub · feedback@pldb.com