I'm working with this custom data type, and I would to be able to show it if the type of a
is showable.
data NonEmpty a = NonEmpty a (Array a)
So I created this type class instance with the dependency that a be showable...
module Main where | |
import Prelude | |
import Data.Array (replicate) | |
import Data.String (length, fromCharArray) | |
import Data.Foldable (for_) | |
import Control.Monad.Eff | |
import Control.Monad.Eff.Console (log, print) |
I'm working with this custom data type, and I would to be able to show it if the type of a
is showable.
data NonEmpty a = NonEmpty a (Array a)
So I created this type class instance with the dependency that a be showable...
-- http://try.purescript.org/?gist=8edc7ff9f3f3bcd347959e9cd2f07376 | |
module Main where | |
import Prelude | |
import Data.Identity | |
import Control.Monad.State | |
import Control.Monad.Except | |
import Control.Monad.Eff.Console (log, logShow) | |
type FirstName = String |
-- http://try.purescript.org/?gist=45bfcac3cf142daaa165323ae45069cd | |
module Main where | |
import Prelude | |
import Control.Monad.Writer(Writer(..), tell, listen, listens, pass, runWriter) | |
import Data.Array(tail, head, drop, length) | |
import Data.String(joinWith) | |
import Data.Tuple(fst, snd, Tuple(..)) | |
import Math (remainder, (%)) | |
import Control.Monad.Eff.Console (log, logShow) |
-- Run with `pulp run --main AffParallel` | |
module AffParallelExample where | |
import Prelude | |
import Control.Monad.Aff (Aff, launchAff, forkAll, later') | |
import Control.Monad.Console (Console, log) | |
import Control.Parallel (parSequence) | |
type Piece = String |
module Connection where | |
import Prelude | |
import Control.Coroutine (Consumer, Producer, await) | |
import Control.Coroutine.Aff (produceAff) | |
import Control.Monad.Aff (Aff, later') | |
import Control.Monad.Aff.AVar (AVAR) | |
import Control.Monad.Aff.Console (CONSOLE, log) | |
import Control.Monad.Eff.Class (liftEff) | |
import Control.Monad.Eff.Random (RANDOM, randomInt) |
module Main where | |
import Prelude | |
import Data.Either (either) | |
import Control.Monad.Aff (Aff, attempt, cancel, forkAff, later', launchAff) | |
import Control.Monad.Aff.Console (CONSOLE, log, logShow) | |
import Control.Monad.Eff.Exception (error) | |
getUpdate :: forall e. Aff (console :: CONSOLE | e) String | |
getUpdate = do |
module Main where | |
import Prelude | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Console (CONSOLE, log, logShow) | |
import Control.Monad.Except (runExcept, throwError) | |
import Data.Array (head, last, length) | |
import Data.Either (Either(Right, Left)) | |
import Data.Foldable (traverse_) | |
import Data.Foreign (F, ForeignError(..), readString, toForeign) |
module MultipleConsumerCoroutine where | |
import Prelude | |
import Data.List as List | |
import Data.List.NonEmpty as NEList | |
import Control.Coroutine (Consumer, Producer, Transformer, await, connect, emit, joinConsumers, runProcess, transform, transformConsumer) | |
import Control.Monad.Aff (Aff, launchAff) | |
import Control.Monad.Aff.Console (log, CONSOLE) | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Exception (EXCEPTION) |
module Main where | |
-- bower install | |
-- "purescript-prelude": "^2.5.0" | |
-- "purescript-console": "^2.0.0" | |
-- "purescript-affjax": "^3.0.2" | |
import Prelude | |
import Control.Monad.Aff (launchAff) | |
import Control.Monad.Aff.Console (log) |