Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot derive (show) from this expression

Tags:

haskell

This code doesn't work

data Expression = Atom String
  | Sequence [Expression]
  deriving (show)

I get this error:

$ runghc bug.hs
ghc: panic! (the 'impossible' happened)
  (GHC version 7.4.1 for x86_64-apple-darwin):
    nameModule show{tv a9J}

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Am I doing something wrong, or is it indeed a bug?

like image 824
user1349427 Avatar asked Apr 22 '12 11:04

user1349427


1 Answers

Type classes start with upper case letters, so that should be Show, not show. Though, GHC should be giving you a decent error message instead of panicking, so that part is indeed a bug.

like image 75
hammar Avatar answered Sep 30 '22 05:09

hammar