Skip to content

Instantly share code, notes, and snippets.

@maurges
Created April 6, 2020 10:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maurges/02ac0f5e0f8fa07791c22421d297d9b9 to your computer and use it in GitHub Desktop.
Save maurges/02ac0f5e0f8fa07791c22421d297d9b9 to your computer and use it in GitHub Desktop.
Mozilla example extension number 1 rewritten in purescript
module Main where
import Prelude
import Effect (Effect)
import Vanilla.Dom.Document (body)
import Vanilla.Dom.Element (setStyle)
main :: Effect Unit
main =
setStyle "border" body "5px solid red"
{ "manifest_version": 2
, "name": "Borderify"
, "version": "1.0"
, "description": "Adds a red border to all webpages matching habr.com"
, "content_scripts": [
{ "matches": ["*://*.habr.com/*"]
, "js": ["content/out.js"]
}
]
}
{
"name": "borderify",
"version": "1.0.0",
"description": "Add borders to a habr page",
"dependencies": {
"purescript": "^0.13.6",
"spago": "^0.13.1"
}
}
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.13.6-20200123/packages.dhall sha256:687bb9a2d38f2026a89772c47390d02939340b01e31aaa22de9247eadd64af05
let overrides = {=}
let additions =
{ vanilla-web =
{ dependencies =
[ "prelude"
, "effect"
, "functions"
, "maybe"
, "partial"
]
, repo =
"https://github.com/d86leader/purescript-vanilla-web.git"
, version =
"c764f569d80e7a507d945c9e2647a871e735a8b6"
}
}
in upstream // overrides // additions
{ name = "borderify"
, dependencies =
[ "console"
, "effect"
, "psci-support"
, "vanilla-web"
]
, packages = ./packages.dhall
, sources = [ "Main.purs" ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment