Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/output/
/.psci*
/src/.webpack.js
/.spago*
1 change: 1 addition & 0 deletions .purs-repl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import Prelude
22 changes: 0 additions & 22 deletions bower.json

This file was deleted.

104 changes: 104 additions & 0 deletions packages.dhall
Original file line number Diff line number Diff line change
@@ -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.4-20211109/packages.dhall sha256:e8d8d5b339f6d46d950da90037c6c38e8809f7e34f727373089ab82c080fc709

in upstream
33 changes: 33 additions & 0 deletions spago.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{-
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 = "screeps"
, dependencies =
[ "argonaut-codecs"
, "argonaut-core"
, "arrays"
, "console"
, "effect"
, "either"
, "exceptions"
, "foreign-object"
, "functions"
, "maybe"
, "partial"
, "prelude"
, "psci-support"
, "tuples"
, "unsafe-coerce"
]
, packages = ./packages.dhall
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
}
9 changes: 4 additions & 5 deletions src/Screeps/ConstructionSite.purs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
-- | Corresponds to the Screeps API [ConstructionSite](http://support.screeps.com/hc/en-us/articles/203016342-ConstructionSite)
module Screeps.ConstructionSite where

import Control.Monad.Eff (Eff)
import Effect

import Screeps.Effects (CMD)
import Screeps.Types (ConstructionSite, Id, ReturnCode, StructureType)
import Screeps.FFI (runThisEffFn0, unsafeField)
import Screeps.FFI (runThisEffectFn0, unsafeField)

id :: ConstructionSite -> Id ConstructionSite
id = unsafeField "id"
Expand All @@ -25,5 +24,5 @@ progressTotal = unsafeField "progressTotal"
structureType :: ConstructionSite -> StructureType
structureType = unsafeField "structureType"

remove :: forall e. ConstructionSite -> Eff (cmd :: CMD | e) ReturnCode
remove = runThisEffFn0 "remove"
remove :: forall e. ConstructionSite -> Effect ReturnCode
remove = runThisEffectFn0 "remove"
2 changes: 1 addition & 1 deletion src/Screeps/Container.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Screeps.Constants (structure_container)
import Screeps.Types (Container, ResourceType(ResourceType), Structure)
import Screeps.FFI (unsafeField)

foreign import data Store :: *
foreign import data Store :: Type

store :: Container -> Store
store = unsafeField "store"
Expand Down
9 changes: 4 additions & 5 deletions src/Screeps/Controller.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
module Screeps.Controller where

import Data.Maybe (Maybe)
import Control.Monad.Eff (Eff)
import Effect

import Screeps.Constants (structure_controller)
import Screeps.Effects (CMD)
import Screeps.FFI (runThisEffFn0, unsafeField)
import Screeps.FFI (runThisEffectFn0, unsafeField)
import Screeps.Structure (unsafeCast)
import Screeps.Types (Controller, ReturnCode, Structure)

Expand All @@ -28,8 +27,8 @@ ticksToDowngrade = unsafeField "ticksToDowngrade"
upgradeBlocked :: Controller -> Int
upgradeBlocked = unsafeField "upgradeBlocked"

unclaim :: forall e. Controller -> Eff (cmd :: CMD | e) ReturnCode
unclaim = runThisEffFn0 "unclaim"
unclaim :: forall e. Controller -> Effect ReturnCode
unclaim = runThisEffectFn0 "unclaim"

toController :: forall a. Structure a -> Maybe Controller
toController = unsafeCast structure_controller
8 changes: 6 additions & 2 deletions src/Screeps/Creep.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
"use strict";

exports.totalAmtCarrying = function(creep){
exports.totalAmtCarrying = function(creep) {
return _.sum(creep.carry);
}
};

exports.freeCapacity = function (creep) {
return creep.store.getFreeCapacity();
};
Loading