-
create-react-native-app purescript-app; cd purescript-app
-
pulp init --force
-
pulp build
-
src/Main.js
var React = require("react");
var RN = require("react-native");
exports.text = function(props){| {-# LANGUAGE ConstraintKinds, DataKinds, DeriveGeneric, DerivingVia #-} | |
| {-# LANGUAGE ExplicitNamespaces, FlexibleContexts, FlexibleInstances #-} | |
| {-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, MultiParamTypeClasses #-} | |
| {-# LANGUAGE PolyKinds, ScopedTypeVariables, StandaloneDeriving #-} | |
| {-# LANGUAGE TypeApplications, TypeFamilies, TypeInType, TypeOperators #-} | |
| {-# LANGUAGE UndecidableInstances #-} | |
| {-# OPTIONS_GHC -Wall #-} | |
| module Data.Aeson.Generic.DerivingVia | |
| ( StrFun(..), Setting(..), SumEncoding'(..), DefaultOptions, WithOptions(..) | |
| , -- Utility type synonyms to save ticks (') before promoted data constructors |
| // Trying to simulate do-notation in TypeScript using async/await | |
| // Trying to convert https://codewithstyle.info/advanced-functional-programming-typescript-monads-generators/ | |
| // to use async/await. Generators work but aren't type safe because of https://github.com/Microsoft/TypeScript/issues/2983 | |
| interface MyPromise<A> { | |
| then<B>(fn: (a: A) => Option<B>): MyPromise<B> | |
| } | |
| export class Option<A> implements MyPromise<A> { |
| import { | |
| end, | |
| int, | |
| lit, | |
| Match, | |
| parse, | |
| Route as RouteBase, | |
| zero | |
| } from "fp-ts-routing"; | |
| import { pipe } from "fp-ts/lib/function"; |
| "use strict"; | |
| var React = require("react"); | |
| var ReactDOM = require("react-dom"); | |
| exports.makeRef = function(toMaybe) { | |
| var Ref = function(props) { | |
| this.DOMNode = null; | |
| return this; | |
| }; |
| #!/usr/bin/env stack | |
| -- stack --resolver lts-10.8 --install-ghc exec ghci | |
| {-# LANGUAGE ConstraintKinds #-} | |
| {-# LANGUAGE ExistentialQuantification #-} | |
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE LambdaCase #-} | |
| -- A key type for pretend use in looking up a doggo in a database. | |
| newtype Key a = Key { unKey :: String } |
create-react-native-app purescript-app; cd purescript-app
pulp init --force
pulp build
src/Main.js
var React = require("react");
var RN = require("react-native");
exports.text = function(props){| let Version = ∀(Version : Type) → ∀(v : Text → Version) → Version | |
| in let VersionRange = | |
| ∀(VersionRange : Type) | |
| → ∀(anyVersion : VersionRange) | |
| → ∀(noVersion : VersionRange) | |
| → ∀(thisVersion : Version → VersionRange) | |
| → ∀(notThisVersion : Version → VersionRange) | |
| → ∀(laterVersion : Version → VersionRange) | |
| → ∀(earlierVersion : Version → VersionRange) |
| {-# LANGUAGE OverloadedLabels #-} | |
| {-# LANGUAGE DuplicateRecordFields #-} | |
| {-# LANGUAGE DeriveGeneric #-} | |
| module LensLabels where | |
| import Prelude | |
| import Control.Lens | |
| import Data.Generics.Labels | |
| import GHC.Generics |
| {-# LANGUAGE DeriveFunctor #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE FunctionalDependencies #-} | |
| {-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE TypeFamilyDependencies #-} | |
| -- Example of interpreting using continuation monad instead of the free monad. | |
| module Main where |