1
Fork 0

Move stuff around + add lean and idris experiments

This commit is contained in:
Matei Adriel 2023-10-29 00:02:10 +02:00
parent a45a4e94b3
commit ca3f83d186
122 changed files with 1959 additions and 2 deletions

10
purescript/compose/.gitignore vendored Normal file
View file

@ -0,0 +1,10 @@
/bower_components/
/node_modules/
/.pulp-cache/
/output/
/generated-docs/
/.psc-package/
/.psc*
/.purs*
/.psa*
/.spago

View file

@ -0,0 +1,104 @@
{-
Welcome to your new Dhall package-set!
Below are instructions for how to edit this file for most use
cases, so that you don't need to know Dhall to use it.
## Use Cases
Most will want to do one or both of these options:
1. Override/Patch a package's dependency
2. Add a package not already in the default package set
This file will continue to work whether you use one or both options.
Instructions for each option are explained below.
### Overriding/Patching a package
Purpose:
- Change a package's dependency to a newer/older release than the
default package set's release
- Use your own modified version of some dependency that may
include new API, changed API, removed API by
using your custom git repo of the library rather than
the package set's repo
Syntax:
where `entityName` is one of the following:
- dependencies
- repo
- version
-------------------------------
let upstream = --
in upstream
with packageName.entityName = "new value"
-------------------------------
Example:
-------------------------------
let upstream = --
in upstream
with halogen.version = "master"
with halogen.repo = "https://example.com/path/to/git/repo.git"
with halogen-vdom.version = "v4.0.0"
with halogen-vdom.dependencies = [ "extra-dependency" ] # halogen-vdom.dependencies
-------------------------------
### Additions
Purpose:
- Add packages that aren't already included in the default package set
Syntax:
where `<version>` is:
- a tag (i.e. "v4.0.0")
- a branch (i.e. "master")
- commit hash (i.e. "701f3e44aafb1a6459281714858fadf2c4c2a977")
-------------------------------
let upstream = --
in upstream
with new-package-name =
{ dependencies =
[ "dependency1"
, "dependency2"
]
, repo =
"https://example.com/path/to/git/repo.git"
, version =
"<version>"
}
-------------------------------
Example:
-------------------------------
let upstream = --
in upstream
with benchotron =
{ dependencies =
[ "arrays"
, "exists"
, "profunctor"
, "strings"
, "quickcheck"
, "lcg"
, "transformers"
, "foldable-traversable"
, "exceptions"
, "node-fs"
, "node-buffer"
, "node-readline"
, "datetime"
, "now"
]
, repo =
"https://github.com/hdgarrood/purescript-benchotron.git"
, version =
"v7.0.0"
}
-------------------------------
-}
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.14.2-20210713/packages.dhall sha256:654c3148cb995f642c73b4508d987d9896e2ad3ea1d325a1e826c034c0d3cd7b
in upstream

View file

@ -0,0 +1,17 @@
{-
Welcome to a Spago project!
You can edit this file as you like.
Need help? See the following resources:
- Spago documentation: https://github.com/purescript/spago
- Dhall language tour: https://docs.dhall-lang.org/tutorials/Language-Tour.html
When creating a new Spago project, you can use
`spago init --no-comments` or `spago init -C`
to generate this file without the comments in this block.
-}
{ name = "my-project"
, dependencies = [ "console", "effect", "exists", "prelude", "psci-support" ]
, packages = ./packages.dhall
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
}

View file

@ -0,0 +1,10 @@
module Compose where
import Prelude hiding (bind, discard)
bind :: forall a b c. (a -> b) -> (b -> c) -> (a -> c)
bind = (>>>)
discard :: forall a b c. (a -> b) -> (Unit -> b -> c) -> (a -> c)
discard f g = f >>> g unit

View file

@ -0,0 +1,44 @@
module Main where
import Prelude
import Compose as Compose
import Data.Exists (Exists)
import Effect (Effect)
import Effect.Class.Console (logShow)
import Unsafe.Coerce (unsafeCoerce)
c :: Int -> Int
c = Compose.do
add2
double
add2 :: Int -> Int
add2 = (+) 2
double :: Int -> Int
double = (*) 2
newtype I a = I a
type EI = Exists I
type Showable f = forall result. (forall r. Show r => f r -> result) -> result
mkShowable :: forall a f. Show a => f a -> Showable f
mkShowable a f = f a
test :: String
test = do
I something <- mkShowable $ I 0
show something
where
bind :: forall f result. Showable f -> (forall r. Show r => f r -> result) -> result
bind e f = e f
magicShow :: forall r. r -> String
magicShow = unsafeCoerce
main :: Effect Unit
main = do
logShow $ c 3

View file

@ -0,0 +1,11 @@
module Test.Main where
import Prelude
import Effect (Effect)
import Effect.Class.Console (log)
main :: Effect Unit
main = do
log "🍝"
log "You should add some tests."