[darcs-users] darcs patch: Begin using RIO (and 39 more)

David Roundy daveroundy at gmail.com
Wed Sep 10 14:48:01 UTC 2008


On Wed, Sep 10, 2008 at 10:46 AM, David Roundy <daveroundy at gmail.com> wrote:
> The bug *here* is basically that _foo is a non-type-safe function.
> It's exporting values with arbitrary type witnesses, which means that
> it is equivalent to unsafeCoerceP.
>
> unsafeCoerceP :: forall a b. a -> b
> unsafeCoerceP x = case foo1 =\/= foo2 of
>                                IsEq -> x
>                                _ -> impossible
>   where foo1 :: Maybe (FL Patch C(() a))
>             foo1 = _foo "input" -- where I give it any input that
> leads to a Just value.
>             foo2 :: Maybe (FL Patch C(() b))
>             foo2 = _foo "input" -- where I give it any input that
> leads to a Just value.

Sorry, this should have been:

unsafeCoerceP :: forall a b. a -> b
unsafeCoerceP x = case foo1 =\/= foo2 of
                               IsEq -> x
                               _ -> impossible
  where foo1 :: FL Patch C(() a)
            Just foo1 = _foo "input"
            foo2 :: FL Patch C(() b)
            Just foo2 = _foo "input"

David


More information about the darcs-users mailing list