This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
#include <util/delay.h> | |
#include "purescript.h" | |
FOREIGN_BEGIN( Main ) | |
exports["blink"] = [](const boxed& n_) -> boxed { | |
const auto n = unbox<int>(n_); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Prelude | |
import Effect (Effect) | |
fib :: Int -> Int | |
fib 0 = 0 | |
fib 1 = 1 | |
fib n = fib (n - 2) + fib (n - 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PureScript to native binary (via C++) Makefile | |
# | |
# Run 'make' or 'make release' to build an optimized release build | |
# Run 'make debug' to build a non-optimized build suitable for debugging | |
# | |
# You can also perform a parallel build with 'make -jN', where N is the | |
# number of cores to use. | |
# | |
# PURS, SRC, OUTPUT, and BIN can all be overridden with the | |
# command itself. For example: 'make BIN=myutil' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Ensure any prebuilt GNUstep packages are uninstalled before running this script | |
# Adapted from | |
# http://wiki.gnustep.org/index.php/GNUstep_under_Ubuntu_Linux | |
# and https://stackoverflow.com/questions/40698870/compiling-objective-c-on-debian-8-gnu-linux-with-clang-and-gnustep-make | |
# Show prompt function | |
function showPrompt() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstring> | |
#include "Main.hh" | |
namespace Main { | |
static auto bitor_all( const any::array& opts ) -> int { | |
int combined_opts = 0; | |
for (auto it = opts.cbegin(), end = opts.cend(); it != end; it++) { | |
combined_opts |= static_cast<int>(*it); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MainFFI_HH | |
#define MainFFI_HH | |
#include <pcre.h> | |
#include "PureScript/PureScript.hh" | |
namespace Main { | |
using namespace PureScript; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Prelude | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Console (CONSOLE, log, logShow) | |
import Data.Either (Either(..)) | |
import Data.Tuple (Tuple) | |
foreign import data PCREOption :: * | |
foreign import data PCRECode :: * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pcre *pcre_compile(const char *pattern, | |
int options, | |
const char **errptr, | |
int *erroffset, | |
const unsigned char *tableptr); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Foldable | |
-- perform a very large foldr to test tail recursion | |
addAll :: (Foldable t, Num a) => t a -> a | |
addAll = Data.Foldable.foldr (+) 0 | |
n :: Integer | |
n = 1500000 | |
numbersList :: [Integer] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#undef _RACAbleObject | |
#define _RACAbleObject(object, property) (object.rac_signalForKeyPath:@keypath(object, property), observer:self) | |
#undef keypath1 | |
#define keypath1(PATH) \ | |
(((void)(NO && ((void)PATH, NO)), strchr(# PATH, *".") + 1)) | |
NewerOlder