Run the test failed with doctest

Skip to first unread message

Nero Zuo

Feb 10, 2017, 3:08:33 AM2/10/17
to nicta-fp

I encountered a problem when running the test failed with doctest 

$ doctest -isrc -Wall -fno-warn-type-defaults src/Course/List.hs
### Failure in src/Course/List.hs:29: expression `instance Arbitrary a => Arbitrary (List a) where arbitrary = P.fmap ((P.foldr (:.) Nil) :: ([a] -> List a)) arbitrary'
 but got:
          <interactive>:29:1: warning: [-Worphans]
             Orphan instance: instance Arbitrary a => Arbitrary (List a)
             To avoid this
                 move the instance declaration to the module of the class or of the type, or
                 wrap the type with a newtype and declare the instance on the new type.
Examples: 58  Tried: 4  Errors: 0  Failures: 1

My computer system is OS X EL Capitan 10.11.6   
GHC version is 8.0.1 

By the way my Ubuntu 16.10 computer works well and its GHC version is 7.10.3

Can anyone help me?   

Zak Patterson

Apr 30, 2017, 5:30:20 PM4/30/17
to nicta-fp

I just got started here yesterday. The workaround for me right now is to add the option `-fno-warn-orphans` to the doctest command.  I'm using GHC 8.0.2 now. 


Tony Morris

Jun 22, 2017, 9:14:05 PM6/22/17
to nicta-fp
Hi Nero,
This is a known problem. Sorry for taking so long to get back to you. We have just now started working toward correcting it. The solution will likely involve removing doctest altogether.
Reply all
Reply to author
0 new messages