Skip to content

This is a collection of Haxe libraries in the functional style intended to cover most functionality you'd need to bring the pertinent parts of your programming up front.

It covers async handling, control flow, composition, parsing, logging, errors, testing, dependency injection, assertions,comparisions and equalities, configuration, immutable datastructres, scheduling and data types that can cover the full range of needs in a granular way with a carefully constructed, consistent Api.

It's by no means complete, and not documented well presently, but the programming style is well balanced, and traces the extents of the Haxe type system well.

Highlights

Simple integration

using stx.Log;

Each library can be used in full with a one liner: using stx.****

Stays out the way.

stx.Pico contains haxe std overrides, all other libraries should not pollute any namespace (to whit:bug reports, although it's 90%).

typically stx.$lib.core.* is used for common names that might and using stx.$lib.Core; used to override that.

Wildcard Static Extensions

from stx.Nano upwards, there is a global reference: __ which allows for things such as:

using stx.Assert;

function assert(){
  var a = null;
  __.assert().exists(a);//throws error
  //or
  __.assert().that().exists().apply(a);//Forward optional error.
}

Creating a Wildcard static extension is as simple as

Main.hx

  using Main;

  function insertion_point(wildcard:Wildcard){
    return new Module();
  }
  private class Module{
    public function new(){}
    public function SomeTypeConstructor(){
      return new SomeTypeConstructor();
    }
  }
  private class SomeTypeConstructor{
    public function new(){}
  }
  class Main{
    static public function main(){
      final module = __.insertion_point();//Instance of Module
      final value  = module.SomeTypeConstructor();
    }
  }

Coherent Async Story

There are fine grained return types for async handling in functional programming style, with a simple API that can be lifted from synchronous to asynchronous functionality very simply.

in stx.Nano

Report is an optional Error with Alert being the asynchronous version

  __.report();//produces `Happened`

  var report  = __.report(f -> f.of(OhNoes));//injects Fault, expexts `Reported<Error<E>>`
  var alert   = report.alert();//Future<Report<E>>

Res is either some value, or some Error (see stx.Fail) with Pledge being the async version.

  __.accept(true);//produces `Accept(true)`;
  var res     = __.reject(__.fault().of(Whassat))// produces `Reject(Whassat)`;
  var pledge  = res.pledge()// Future<Upshot<T,E>> known as Pledge<T,E>

You can conditionally handle parts of the Res/Pledge structure.

either:

//point
Upshot<R,E> -> (R -> Report<E>) -> Report<E>

or:

//point  
Pledge<R,E> -> (R -> Report<E>) -> Alert<E>
  var res = __.accept(true);
  var eaten = res.point(
    (b:Bool) -> {
      final is_ok = some_outside_handler(b);
      return is_ok ? __.report() : __.report(f -> f.of(SomethingWentWrong));
    }
  );//Report<E>

And there are various different mechanisms to carve out error subsets, integrate to upstream systems and produce cleaned values.

  enum SubSystemError{
    OOF;
  }
  enum SuperSystemError{
    Wot(err:SubSystemError);
  }
  function test_error(){
    final oops = __.fault().of(OOF);//Error<SubSystemError>;
    final upstream = oops.errate(Wot);//Error<SuperSystemError>;
  }

Each of these are monad instances with a couple extra methods for integration.

Advanced Programming Space.

Beyond Futures and Streams lie stx.Fletcher, stx.Coroutines and stx.Proxy, capable of sophisticated interpolation,ordering schemes and partial applications over bi-directional streaming data, and a complete set of primitives to describe any operation existing in the space between functions, and the customisable scheduling of their closures and effects.

  //Describes a composable arrowlet/function that can return work for a scheduler to perform.
  typedef FletcherDef<P,R> = P -> (Void -> R) -> Work

Ambiguous remote response datatypes and combinators are also to be found, although they're a little less mature.

Highly Speciated Errors

Much of Haxe's strengh lies in integrating with pre-existing systems. stx.Fail allows for fine grained control over known and unknown errors and provides the discipline to take on any and all states of your program.

enum Failures{
  SysFail;
}
final err   : Error<Failures> = __.fault().of(SysFail);
final errI  : Error<Failures> = __.fault().digest(_ -> (pos:Pos) -> )

Immutable Datastructures

Including LinkedList, RedBlackSet, RedBlackMap, BTree, KTree and Graph.

Popular repositories Loading

  1. stx_query stx_query Public

    Typedefs for query language

    Haxe 4

  2. stx_coroutine stx_coroutine Public

    [In Development]Algebra of coroutines.

    Haxe 3

  3. stx_fail stx_fail Public

    Structured and Unstructured Errors

    Haxe 3

  4. datura datura Public

    [incubating] Composable peer to peer networking library based on stx_coroutine and peote-net

    Haxe 3

  5. stx_nano stx_nano Public

    Compact selection of powertools. No real overlap with common libraries, so safe to use in the global scope

    Haxe 2

  6. bake bake Public

    Persistence between builds

    Haxe 2

Repositories

Showing 10 of 87 repositories
  • stx_equity Public

    Datatypes for ambiguous data

    ohmrun/stx_equity’s past year of commit activity
    Haxe 0 0 0 0 Updated May 6, 2025
  • stx_fn Public

    previously 'Pointwise'. Function combinator library for Haxe

    ohmrun/stx_fn’s past year of commit activity
    Haxe 0 0 0 0 Updated May 5, 2025
  • stx_test Public

    test framework with stream interface

    ohmrun/stx_test’s past year of commit activity
    Haxe 0 0 0 0 Updated May 5, 2025
  • walker Public

    immutable asynchronous state charts

    ohmrun/walker’s past year of commit activity
    Haxe 1 0 0 0 Updated May 5, 2025
  • stx_query Public

    Typedefs for query language

    ohmrun/stx_query’s past year of commit activity
    Haxe 4 0 0 0 Updated May 5, 2025
  • stx_pkg Public

    package information

    ohmrun/stx_pkg’s past year of commit activity
    Haxe 0 0 0 0 Updated May 5, 2025
  • stx_parse Public

    Composable LR pack-rat parser (async be damned)

    ohmrun/stx_parse’s past year of commit activity
    Haxe 0 0 0 0 Updated May 5, 2025
  • stx_om Public

    Jsonic Object Model with type holes.

    ohmrun/stx_om’s past year of commit activity
    Haxe 0 0 0 0 Updated May 5, 2025
  • stx_log Public

    Logging library. Flexible filters.

    ohmrun/stx_log’s past year of commit activity
    Haxe 0 0 0 0 Updated May 5, 2025
  • stx_expect Public

    composable predicates

    ohmrun/stx_expect’s past year of commit activity
    Haxe 1 0 0 0 Updated May 5, 2025

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…