diff --git a/hood.cabal b/hood.cabal index 71c5c3e..fd1fc00 100644 --- a/hood.cabal +++ b/hood.cabal @@ -26,6 +26,12 @@ Library Exposed-modules: Debug.Hood.Observe +Test-Suite hood-test + Type: exitcode-stdio-1.0 + Hs-Source-Dirs: test + Main-Is: test.hs + Build-Depends: base, ghc-prim, hood + source-repository head type: git location: https://github.com/ku-fpg/hood diff --git a/test/test.hs b/test/test.hs new file mode 100644 index 0000000..9c65cb1 --- /dev/null +++ b/test/test.hs @@ -0,0 +1,26 @@ +#!/usr/bin/env stack +{-# LANGUAGE DeriveGeneric #-} +-- stack --resolver lts-8.4 runghc --package hood +-- Minimum program to reproduce https://github.com/ku-fpg/hood/issues/5 + +import Debug.Hood.Observe +import GHC.Generics + + +data Hoge = + Hoge + { hoge1 :: Int + , hoge2 :: String + } deriving Generic + +instance Observable Hoge + + +main :: IO () +main = runO $ print $ f undefined + + +f :: Hoge -> Bool +f = observe "f" f' +f' :: Hoge -> Bool +f' h@(Hoge _h1 _h2) = error "ERROR"