{"action":"created","issue":{"url":"https://api.github.com/repos/gcanti/cerebral-tcomb/issues/3","labels_url":"https://api.github.com/repos/gcanti/cerebral-tcomb/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/gcanti/cerebral-tcomb/issues/3/comments","events_url":"https://api.github.com/repos/gcanti/cerebral-tcomb/issues/3/events","html_url":"https://github.com/gcanti/cerebral-tcomb/issues/3","id":101573194,"number":3,"title":"expose a getType method on the controller","user":{"login":"gcanti","id":878912,"avatar_url":"https://avatars.githubusercontent.com/u/878912?v=3","gravatar_id":"","url":"https://api.github.com/users/gcanti","html_url":"https://github.com/gcanti","followers_url":"https://api.github.com/users/gcanti/followers","following_url":"https://api.github.com/users/gcanti/following{/other_user}","gists_url":"https://api.github.com/users/gcanti/gists{/gist_id}","starred_url":"https://api.github.com/users/gcanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcanti/subscriptions","organizations_url":"https://api.github.com/users/gcanti/orgs","repos_url":"https://api.github.com/users/gcanti/repos","events_url":"https://api.github.com/users/gcanti/events{/privacy}","received_events_url":"https://api.github.com/users/gcanti/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/gcanti/cerebral-tcomb/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/gcanti/cerebral-tcomb/milestones/1","html_url":"https://github.com/gcanti/cerebral-tcomb/milestones/v0.2.1","labels_url":"https://api.github.com/repos/gcanti/cerebral-tcomb/milestones/1/labels","id":1259921,"number":1,"title":"v0.2.1","description":"","creator":{"login":"gcanti","id":878912,"avatar_url":"https://avatars.githubusercontent.com/u/878912?v=3","gravatar_id":"","url":"https://api.github.com/users/gcanti","html_url":"https://github.com/gcanti","followers_url":"https://api.github.com/users/gcanti/followers","following_url":"https://api.github.com/users/gcanti/following{/other_user}","gists_url":"https://api.github.com/users/gcanti/gists{/gist_id}","starred_url":"https://api.github.com/users/gcanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcanti/subscriptions","organizations_url":"https://api.github.com/users/gcanti/orgs","repos_url":"https://api.github.com/users/gcanti/repos","events_url":"https://api.github.com/users/gcanti/events{/privacy}","received_events_url":"https://api.github.com/users/gcanti/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2015-08-18T05:15:59Z","updated_at":"2015-08-18T05:16:35Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-08-18T05:15:20Z","updated_at":"2015-08-18T19:10:43Z","closed_at":null,"body":""},"comment":{"url":"https://api.github.com/repos/gcanti/cerebral-tcomb/issues/comments/132321269","html_url":"https://github.com/gcanti/cerebral-tcomb/issues/3#issuecomment-132321269","issue_url":"https://api.github.com/repos/gcanti/cerebral-tcomb/issues/3","id":132321269,"user":{"login":"a-s-o","id":6897926,"avatar_url":"https://avatars.githubusercontent.com/u/6897926?v=3","gravatar_id":"","url":"https://api.github.com/users/a-s-o","html_url":"https://github.com/a-s-o","followers_url":"https://api.github.com/users/a-s-o/followers","following_url":"https://api.github.com/users/a-s-o/following{/other_user}","gists_url":"https://api.github.com/users/a-s-o/gists{/gist_id}","starred_url":"https://api.github.com/users/a-s-o/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-s-o/subscriptions","organizations_url":"https://api.github.com/users/a-s-o/orgs","repos_url":"https://api.github.com/users/a-s-o/repos","events_url":"https://api.github.com/users/a-s-o/events{/privacy}","received_events_url":"https://api.github.com/users/a-s-o/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T19:10:43Z","updated_at":"2015-08-18T19:10:43Z","body":"Hi, the current syntax for cerebral models does make it hard to do. Here is how I am doing it\r\n\r\n```javascript\r\n   function modelFactory (controller) {\r\n      const Model = require('cerebral-tcomb')(State({ /*initial state*/ }));\r\n      const model = Model(controller);\r\n\r\n      model.get = _.wrap(model.get, function wrapped$get (next, path) {\r\n         const value = next(path);\r\n         if (!t.Nil.is(value)) return value;\r\n\r\n         const type = model.getType(path);\r\n         if (type.loader) {\r\n            ...\r\n         }\r\n      });\r\n\r\n      return model;\r\n   }\r\n\r\n   const controller = require('cerebral')(modelFactory, defaultInput);\r\n```"}}