{"action":"created","issue":{"url":"https://api.github.com/repos/haskell/primitive/issues/180","repository_url":"https://api.github.com/repos/haskell/primitive","labels_url":"https://api.github.com/repos/haskell/primitive/issues/180/labels{/name}","comments_url":"https://api.github.com/repos/haskell/primitive/issues/180/comments","events_url":"https://api.github.com/repos/haskell/primitive/issues/180/events","html_url":"https://github.com/haskell/primitive/issues/180","id":337922431,"node_id":"MDU6SXNzdWUzMzc5MjI0MzE=","number":180,"title":"write up policies for 'Prim' typeclass","user":{"login":"chessai","id":18648043,"node_id":"MDQ6VXNlcjE4NjQ4MDQz","avatar_url":"https://avatars2.githubusercontent.com/u/18648043?v=4","gravatar_id":"","url":"https://api.github.com/users/chessai","html_url":"https://github.com/chessai","followers_url":"https://api.github.com/users/chessai/followers","following_url":"https://api.github.com/users/chessai/following{/other_user}","gists_url":"https://api.github.com/users/chessai/gists{/gist_id}","starred_url":"https://api.github.com/users/chessai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chessai/subscriptions","organizations_url":"https://api.github.com/users/chessai/orgs","repos_url":"https://api.github.com/users/chessai/repos","events_url":"https://api.github.com/users/chessai/events{/privacy}","received_events_url":"https://api.github.com/users/chessai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-03T14:23:22Z","updated_at":"2018-07-03T17:35:56Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I think we should include a write-up about what makes sense in a `Prim` instance. Some specific points I've thought of are what makes a valid `Prim` instance (laws), what makes sense to have a `Prim` instance, why certain things are excluded, etc.\r\n\r\nFor example, I just discussed with @andrewthad about why `Bool` doesn't have a `Prim` instance. Aside from space inefficiency, let's say we map `True` to 1 and `False` to 0, then writing a byte to a `ByteArray#` means that only 1 and 0 are valid, and we cannot interpret any byte other than 0 or 1 as a `Bool`. This makes sense for anything which cannot be talked about in bytes (i.e. its size is not at least 1 byte)."},"comment":{"url":"https://api.github.com/repos/haskell/primitive/issues/comments/402236436","html_url":"https://github.com/haskell/primitive/issues/180#issuecomment-402236436","issue_url":"https://api.github.com/repos/haskell/primitive/issues/180","id":402236436,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjIzNjQzNg==","user":{"login":"cartazio","id":4290,"node_id":"MDQ6VXNlcjQyOTA=","avatar_url":"https://avatars2.githubusercontent.com/u/4290?v=4","gravatar_id":"","url":"https://api.github.com/users/cartazio","html_url":"https://github.com/cartazio","followers_url":"https://api.github.com/users/cartazio/followers","following_url":"https://api.github.com/users/cartazio/following{/other_user}","gists_url":"https://api.github.com/users/cartazio/gists{/gist_id}","starred_url":"https://api.github.com/users/cartazio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cartazio/subscriptions","organizations_url":"https://api.github.com/users/cartazio/orgs","repos_url":"https://api.github.com/users/cartazio/repos","events_url":"https://api.github.com/users/cartazio/events{/privacy}","received_events_url":"https://api.github.com/users/cartazio/received_events","type":"User","site_admin":false},"created_at":"2018-07-03T17:35:56Z","updated_at":"2018-07-03T17:35:56Z","author_association":"MEMBER","body":"1) Prim's intent / historical context  (and Primitive as a whole):\r\n    to be a type * wrapper around reading writing to memory locations holding the various builtin / primitive ghc types, to hide / manage that stuff for Vector.\r\n\r\nThis means that anything that doesn't just cleanly map to portable ghc machine semantics is out of scope\r\n\r\nsome consequences: \r\nbecause GHC's memory allocator only does multiples of a native machine word/pointer, and unlifted unboxed types correspond (always! at least historically ignoring array stuff) to a value that will possibly be passed by register (aka sort of by value), and who's in memory representation on the heap will generally be at least the size of a native word.\r\n\r\nThis is actually a very *good* thing by default! Most / all computing hardware / CPU designs do not provide *sub*-word sized atomic operations, so mutable memory atomics generally work on word (32/64bit ) sized units of memory. (ok, technically the real granularity of CPU atomics is an entire cache line ... but not the point)\r\n\r\nthe real answer is this: there really really shouldn't be user defined Prim instances, we should move  the Array kit into vector, and iterate on the different memory layout semantics choices land scape there, and also make the pure array api's take advantage of applicable fusion framework engineering"}}
{"actor":{"display_login":"cartazio"}}