Last active
August 29, 2015 14:00
-
-
Save robinske/11197860 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lessonDelta[M] | |
(sm: ServiceModel[M], uid: UserId, courseKey: String) | |
(delta: IndexedSeq[Lesson] => ModelState[M, IndexedSeq[Lesson]]): ModelState[M, Unit] = | |
for { | |
courseId <- sm.findCourseId(courseKey) | |
_ <- sm.asAuthor(uid, courseId) | |
oldStatus <- sm.getSandboxStatusById(courseId) | |
courseToUpdate <- sm.sandboxedCourse(courseId, oldStatus) | |
oldPalette <- sm.getGadgetPalette(courseId, Course.SANDBOX) | |
// this line is failing: | |
changedLessons <- delta(courseToUpdate.lessons) | |
newPalette <- CourseParser.derivePalette(sm, oldPalette, changedLessons) | |
updatedSandboxCourse <- courseToUpdate.updateLessons(changedLessons) | |
updatedSandboxStatus = | |
SandboxChanges.validate(updatedSandboxCourse, sm.stagedStatus(oldStatus)) | |
_ <- sm.mc.setSandboxStatus(courseId, updatedSandboxStatus) | |
_ <- sm.mc.setGadgetPalette(courseId, Course.SANDBOX, newPalette) | |
} yield () | |
//[error] /Users/kelleyrobinson/src/rest-api/src/main/scala/endpoints/CourseEndpoints.scala:774: | |
// Unable to unapply type `com.versal.restapi.Course` into a type constructor of kind `M[_]` | |
// that is classified by the type class `scalaz.Functor` | |
//[error] 1) Check that the type class is defined by compiling `implicitly[scalaz.Functor[<type constructor>]]`. | |
//[error] 2) Review the implicits in object Unapply, which only cover common type 'shapes' | |
//[error] (implicit not found: scalaz.Unapply[scalaz.Functor, com.versal.restapi.Course]) | |
//[error] updatedSandboxCourse <- courseToUpdate.updateLessons(changedLessons) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment