This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-04
Channels
- # admin-announcements (6)
- # alda (1)
- # announcements (3)
- # aws (4)
- # beginners (233)
- # boot (82)
- # cider (11)
- # cljsjs (21)
- # cljsrn (7)
- # clojure (262)
- # clojure-japan (1)
- # clojure-russia (129)
- # clojure-sg (2)
- # clojure-taiwan (2)
- # clojurecup (23)
- # clojurescript (162)
- # clojurex (3)
- # core-async (18)
- # cursive (81)
- # datavis (183)
- # datomic (23)
- # emacs (2)
- # funcool (25)
- # ldnclj (82)
- # lein-figwheel (3)
- # om (196)
- # onyx (74)
- # parinfer (7)
- # portland-or (12)
- # re-frame (60)
- # reagent (48)
- # slack-help (1)
- # yada (9)
Hello.
I'm newbie to Clojure, and trying to use https://github.com/funcool/cats
So I create a new project with lein
, then add [funcool/cats "1.1.0"]
as dependency in project.clj
, and my core.clj
gets as simple as:
(ns core-clojure.core
(:require [cats.core :as m])
(:gen-class))
(defn -main
"Main"
[& args]
(m/mappend [1 2 3] [4 5 6])
(println "Hello, World!"))
which gives following error when running like lein run
from command line:
Exception in thread "main" java.lang.IllegalArgumentException: No context is set and it can not be automatically resolved., compiling:(/tmp/form-init1960448665477151794.clj:1:73)
Any ideas?
@lizzie: IIRC by default core datatypes have no protocols implemented for them, so they can't act like monoids and whatnot.
If you want to see how they behave here are the implementations - https://github.com/funcool/cats/blob/master/src/cats/builtin.cljc
I guess it's done this way because someone might want them to behave differently - for example the monoid implementation of map does shallow merging, someone might want recursive merging for example.
For example if you modify the map monoid for recursive merging you can get pretty nice validators with maps and sets with the validation applicative in only a few tens of lines of code.
So that's probably why the default implementation is something you have to knowingly require - if they suit you, require them and use them, otherwise write your own.
@niwinz: as I understand there's no way to require only some default implementations right now, yes?
Maybe in a future we can think modularize that part, but at this moment we found the current solution a good start point and it works pretty well
[ann]: promesa 0.6.0 is released yesterday, now is cross-platform (clj and cljs) and can be used in almost the same way in the both platforms