packages feed

purescript-0.13.0: tests/purs/publish/basic-example/output/Unsafe.Coerce/docs.json

{"reExports":[],"name":"Unsafe.Coerce","comments":null,"declarations":[{"children":[],"comments":"A _highly unsafe_ function, which can be used to persuade the type system that\nany type is the same as any other type. When using this function, it is your\n(that is, the caller's) responsibility to ensure that the underlying\nrepresentation for both types is the same.\n\nOne application for this function is to avoid doing work that you know is a\nno-op because of newtypes. For example, if you have an `Array (Conj a)` and you\nwant an `Array (Disj a)`, you could do `Data.Array.map (runConj >>> Disj)`, but\nthis performs an unnecessary traversal. `unsafeCoerce` accomplishes the same\nfor free.\n\nIt is highly recommended to define specializations of this function rather than\nusing it as-is. For example:\n\n```purescript\nmapConjToDisj :: forall a. Array (Conj a) -> Array (Disj a)\nmapConjToDisj = unsafeCoerce\n```\n\nThis way, you won't have any nasty surprises due to the inferred type being\ndifferent to what you expected.\n","title":"unsafeCoerce","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},null]},null]}},"sourceSpan":{"start":[27,1],"name":"../../../support/bower_components/purescript-unsafe-coerce/src/Unsafe/Coerce.purs","end":[27,50]}}]}