@@ -2,17 +2,16 @@
22
33module Nock (tar, hax, fas, cell, atom, Annotation (..), Noun, RawNoun (..)) where
44
5+import Control.DeepSeq (NFData)
56import Data.Hashable
6−import Debug.Trace (trace, traceShowId)
77import GHC.Generics (Generic)
8−import GHC.Stack
98import Numeric.Natural
10−import Test.QuickCheck.Arbitrary.Generic
119
1210data Annotation = Annotation
1311 { hash :: Int
1412 }
15− deriving stock (Show)
13+ deriving stock (Show, Generic)
14+ deriving anyclass (NFData)
1615
1716atom :: Natural -> Noun
1817atom nat = Atom nat Annotation {hash = hash nat}
@@ -40,6 +39,7 @@ data RawNoun ann
4039 = Atom !Natural ann
4140 | Cell (RawNoun ann) (RawNoun ann) ann
4241 deriving stock (Generic, Show)
42+ deriving anyclass (NFData)
4343
4444instance Eq (RawNoun ann) where
4545 (Atom lhs _) == (Atom rhs _) = lhs == rhs
@@ -70,8 +70,7 @@ fas ~(Cell ~(Atom lhs _) rhs _) =
7070 case lhs of
7171 1 -> rhs
7272 2 -> case rhs of
73− (Cell lhs' _ _) -> lhs'
74− _ -> undefined
73+ ~(Cell lhs' _ _) -> lhs'
7574 3 -> case rhs of
7675 ~(Cell _ rhs' _) -> rhs'
7776 n