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 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) |
| -- 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 |
| -- 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) |
| -- 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 |
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) |