Skip to content

Instantly share code, notes, and snippets.

View epost's full-sized avatar

Erik Post epost

View GitHub Profile
@epost
epost / Animal.scala
Created November 19, 2015 14:38
marco-code-sessie-1-1212xx-geloof-ik
class Animal {
def makeSound() = "Hi! I weigh " + weight
val weight = 15.5
}
class Dog extends Animal {
override def makeSound() = "woof!"
override val weight = 2.0
}
@epost
epost / example-completions.json
Last active November 16, 2015 14:57
JSON schema for psc-ide
[
{
"module": "Data.Array",
"identifier": "filter",
"type": "forall a. (a -> Boolean) -> Array a -> Array a"
},
{
"module": "Data.Array",
"identifier": "map",
"type": "forall a b. (a -> b) -> Array a -> Array b"
@epost
epost / README.org
Last active October 25, 2015 16:03
haskell-ide model example 1

About

IDEs, and programming language tools in general, translate software facts (obtained from source code, library definitions, object files, etc.) and user input to other useful forms, such as editor or compiler actions, and diagrams. My proposal:

  • Separate queries and commands
    • query examples:
      • find location of definition of foo
      • find all locations that reference fromMaybe
      • find all possible completions at some location (e.g. my cursor): completions <FILE> <LINE> <COL>
    • command examples:
joinTraverse f m = fmap join (traverse f m)
;; TODO
;; - Use temp files so emacs can write the current buffer status to an intermediate save file
;; and have pulp compile that. This way, flycheck doesn't have to wait until the user
;; saves the buffer manually, and provide *actual* on-the-fly checking.
;;
;; - Format links to error explanations on purescript wiki nicely.
;; adapted from https://github.com/spion/purscheck/blob/master/purscheck.el
(eval-after-load 'flycheck
'(progn
{
"uploader": null,
"packageMeta": {
"moduleType": [
"node"
],
"repository": {
"url": "git://github.com/epost/purescript-node-postgres.git",
"type": "git"
},
-- | The `partition` function takes a predicate and a list, and returns the pair
-- | of lists of elements which do and do not satisfy the
-- | predicate, respectively.
-- |
-- | ```purescript
-- | partition (< 3) [1,2,3,4,5] == Tuple ([1,2]) ([3,4,5])
-- | ```
partition :: forall a. (a -> Boolean) -> [a] -> Tuple [a] [a]
partition p xs = foldr (select p) (Tuple [] []) xs
@epost
epost / purescript-support.el
Last active August 29, 2015 14:16
purescript support tidbits for emacs
(defun purescript-pursuit-search (query-str)
"Search Pursuit for given search string"
(browse-url (concat "http://pursuit.purescript.org/?q=" query-str))
)
;; TODO
;; - use symbol at point as default query?
;; - simply called 'hoogle' and 'hayoo' in haskell-mode
;; - browse *inside* emacs?
;; - case sensitivity?
@epost
epost / ContTInferenceQuestion.purs
Created January 24, 2015 15:53
ContT inference question
-- Some code excerpts to illustrate the following question:
-- Why is the type ascription
--
-- :: forall eff. ContT _ _ [F Number]
--
-- below necessary? Why isn't `[F a]` inferred to be `[F Number]` from
-- our use of `:: Query a` in the call to `runQueryCont`?
-- My assumption: choosing a `Query a` fixes `a` as well as the `[F a]` in the result type
runQueryCont :: forall eff a rxx. (IsForeign a) => Query a -> Client -> ContT rxx (DBEff eff) [F a]
@epost
epost / thesis-call-graph.neo4j.adoc
Last active August 29, 2015 14:08
Function call graph validation from MSc thesis

Call graph validation

Call graph