Last active
January 4, 2020 06:40
Revisions
-
spicydonuts revised this gist
Nov 19, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -133,7 +133,7 @@ mirror a = Tuple a (reverse a) * [Tic-Tac-Toe -- Part 1](https://kritzcreek.github.io/example/2015/10/03/tic-tac-toe-with-purescript/) * [Tic-Tac-Toe -- Part 2](https://kritzcreek.github.io/tutorial/2015/10/07/playing-tic-tac-toe-with-purescript-signal/) [Completed Main.purs](https://gist.github.com/spicydonuts/202fc7a9fe456b2e069e) (don't cheat!) ## More stuff -
spicydonuts revised this gist
Nov 19, 2015 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -133,6 +133,8 @@ mirror a = Tuple a (reverse a) * [Tic-Tac-Toe -- Part 1](https://kritzcreek.github.io/example/2015/10/03/tic-tac-toe-with-purescript/) * [Tic-Tac-Toe -- Part 2](https://kritzcreek.github.io/tutorial/2015/10/07/playing-tic-tac-toe-with-purescript-signal/) [Main.purs](https://gist.github.com/spicydonuts/202fc7a9fe456b2e069e) ## More stuff * [PureScript by Example](https://leanpub.com/purescript/read) (ebook by Phil Freeman) -
spicydonuts revised this gist
Nov 19, 2015 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -144,5 +144,4 @@ mirror a = Tuple a (reverse a) * [PureScript Wiki - Learn](http://www.purescript.org/learn/) * [PureScript subreddit](https://www.reddit.com/r/purescript) * [QuickCheck your JavaScript!](http://www.purescript.org/learn/quickcheck/) * [Haskell Programming](http://haskellbook.com/) -- great intro to FP, Haskell, and all this 'type' stuff -
spicydonuts revised this gist
Nov 19, 2015 . 1 changed file with 24 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -86,6 +86,28 @@ silence :: Maybe String silence = Nothing ``` ```purescript type User = { name :: String , email :: String } type Userish a = { name :: String , email :: String | a } ``` ```purescript import Prelude import Control.Monad.Eff import Control.Monad.Eff.Console sayHi :: forall eff. Eff (console :: CONSOLE | eff) Unit sayHi = log "hello world." main = sayHi ``` ```purescript data Direction = North @@ -122,3 +144,5 @@ mirror a = Tuple a (reverse a) * [PureScript Wiki - Learn](http://www.purescript.org/learn/) * [PureScript subreddit](https://www.reddit.com/r/purescript) * [QuickCheck your JavaScript!](http://www.purescript.org/learn/quickcheck/) * [Haskell Programming](http://haskellbook.com/) -- great intro to FP, Haskell, and all this 'type' stuff -
spicydonuts revised this gist
Nov 19, 2015 . 1 changed file with 41 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,10 +3,10 @@ ###### What is it? * Compiles to JavaScript * Haskell-inspired type system (with some improvements!) * No runtime (unlike Elm, GHCJS, etc) * A focus on _readable_ and _debuggable_ JavaScript ## Installing @@ -15,19 +15,37 @@ npm i -g purescript pulp ``` ###### PureScript - psc - psci - ... ###### Pulp - `pulp init` - `pulp build` - `pulp test` - `pulp docs` - `pulp server` ## Editor Support Atom via [psc-ide](https://github.com/kRITZCREEK/psc-ide), [ide-purescript](https://atom.io/packages/ide-purescript), and [language-purescript](https://atom.io/packages/language-purescript) ``` git clone https://github.com/kRITZCREEK/psc-ide.git cd psc-ide stack install ``` ``` apm install ide-purescript purescript-language ``` Vim and Emacs plugins too! ## Let's compile some code! ```purescript @@ -87,3 +105,20 @@ instance reversibleDirection :: Reversible Direction where mirror :: forall a. (Reversible a) => a -> Tuple a a mirror a = Tuple a (reverse a) ``` ## Project! * [Tic-Tac-Toe -- Part 1](https://kritzcreek.github.io/example/2015/10/03/tic-tac-toe-with-purescript/) * [Tic-Tac-Toe -- Part 2](https://kritzcreek.github.io/tutorial/2015/10/07/playing-tic-tac-toe-with-purescript-signal/) ## More stuff * [PureScript by Example](https://leanpub.com/purescript/read) (ebook by Phil Freeman) * [IRC Channel](http://webchat.freenode.net/?channels=purescript) * [Pursuit](http://pursuit.purescript.org/) -- "google (hoogle) for PureScript types and libraries" * [Recommended libraries](https://github.com/purescript/purescript/wiki/Recommended-Libraries) * [Halogen and routing in PureScript](http://www.parsonsmatt.org/programming/2015/10/22/purescript_router.html) * [4 part Elm vs PureScript comparison](http://www.parsonsmatt.org/programming/2015/10/03/elm_vs_purescript.html) (this eventually turns into "using the Elm Architecture in PureScript") * [PureScript Wiki - Learn](http://www.purescript.org/learn/) * [PureScript subreddit](https://www.reddit.com/r/purescript) * [QuickCheck your JavaScript!](http://www.purescript.org/learn/quickcheck/) -
spicydonuts revised this gist
Nov 19, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ # [PureScript](http://www.purescript.org/) ###### What is it? * compiles to js * haskell-inspired type system (with some improvements!) * no runtime (unlike elm, ghcjs, etc) * focus on _readable_ and _debuggable_ js -
spicydonuts revised this gist
Nov 19, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ # PureScript ###### What is it? * compiles to js * advanced, haskell-inspired type system () * no runtime (unlike elm, ghcjs, etc) * focus on _readable_ and _debuggable_ js -
spicydonuts revised this gist
Nov 19, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # PureScript What is it? * compile to js * advanced, haskell-inspired type system () -
spicydonuts revised this gist
Nov 19, 2015 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,34 +1,34 @@ # PureScript ## What is it? * compile to js * advanced, haskell-inspired type system () * no runtime (unlike elm, ghcjs, etc) * focus on _readable_ and _debuggable_ js ## Installing ```shell npm i -g purescript pulp ``` ###### PureScript: - psc - psci - ... ###### Pulp: - `pulp init` - `pulp build` - `pulp test` - `pulp docs` - `pulp server` ## Let's compile some code! ```purescript x :: Number -
spicydonuts created this gist
Nov 19, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,89 @@ # purescript ## what is it? * compile to js * advanced, haskell-inspired type system () * no runtime (unlike elm, ghcjs, etc) * focus on _readable_ and _debuggable_ js ## installing ```shell npm i -g purescript pulp ``` ###### purescript: - psc - psci - ... ###### pulp: - `pulp init` - `pulp build` - `pulp test` - `pulp docs` - `pulp server` ## let's compile some code! ```purescript x :: Number x = 5.0 ``` ```purescript y :: Int y = 5 ``` ```purescript import Prelude ((+)) add :: Number -> Number -> Number add x y = x + y ``` ```purescript import Prelude ((+)) add :: Int -> Int -> Int add x y = x + y ``` ```purescript data Maybe a = Nothing | Maybe a ``` ```purescript data Maybe a = Nothing | Maybe a greeting :: Maybe String greeting = Just "hello." silence :: Maybe String silence = Nothing ``` ```purescript data Direction = North | South | East | West class Reversible a where reverse :: a -> a instance reversibleDirection :: Reversible Direction where reverse North = South reverse South = North reverse East = West reverse West = East mirror :: forall a. (Reversible a) => a -> Tuple a a mirror a = Tuple a (reverse a) ```