[ ghc-Bugs-452270 ] fromDynamic crashes ghci

noreply@sourceforge.net noreply@sourceforge.net
Fri, 17 Aug 2001 17:15:45 -0700


Bugs item #452270, was opened at 2001-08-17 17:15
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=108032&aid=452270&group_id=8032

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Avi Pfeffer (apfeffer)
Assigned to: Nobody/Anonymous (nobody)
Summary: fromDynamic crashes ghci

Initial Comment:
Loading the following code into ghci and evaluating x
causes a segmentation fault:

data Foo a = Foo a

instance Typeable (Foo a) where
  typeOf x = mkAppTy (mkTyCon "BAD") []

x :: Maybe (Foo Char)
x = fromDynamic (toDyn (Foo "abc"))

This is not a problem for ghc.

The version of ghci is 5.00.2

I'm running on linux, not sure what vintage I'm afraid.

By the way, the reason I wrote this code was because I
was trying to figure out what role the type string
plays in the Dynamic library.  The documentation seems
to indicate that it is checked for equality every time
fromDyn or fromDynamic is called, but that doesn't seem
to be the case.  More documentation on what the string
does, and how to construct it correctly, would be
appreciated.  I was trying to figure out if I could
make this type Typeable:

data Name a = String






----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=108032&aid=452270&group_id=8032