1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
From 5f36de89409574c5f3f2ea5125cfab331976aa06 Mon Sep 17 00:00:00 2001
From: hololeap <hololeap@protonmail.com>
Date: Wed, 21 Jan 2026 01:34:01 -0700
Subject: [PATCH 1/1] Migrate to cabal-doctest
doctest pulls in the out-of-scope packages if they are installed on the
system. The best workaround is to use migrate to cabal-doctest.
Bug: https://github.com/gentoo-haskell/gentoo-haskell/issues/1231
Signed-off-by: hololeap <hololeap@protonmail.com>
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE CPP #-}
+
+module Main (main) where
+
+#ifndef MIN_VERSION_cabal_doctest
+#define MIN_VERSION_cabal_doctest(x,y,z) 0
+#endif
+
+#if MIN_VERSION_cabal_doctest(1,0,0)
+
+import Distribution.Extra.Doctest ( defaultMainWithDoctests )
+
+main :: IO ()
+main = defaultMainWithDoctests "mwc-doctests"
+
+#else
+
+import Distribution.Simple
+
+main :: IO ()
+main = defaultMain
+
+#endif
--- a/Setup.lhs
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env runhaskell
-> import Distribution.Simple
-> main = defaultMain
--- a/mwc-random.cabal
+++ b/mwc-random.cabal
@@ -1,5 +1,5 @@
cabal-version: 3.0
-build-type: Simple
+build-type: Custom
name: mwc-random
version: 0.15.3.0
license: BSD-2-Clause
@@ -61,6 +61,11 @@ flag BenchPAPI
Default: False
Manual: True
+custom-setup
+ setup-depends:
+ base
+ , cabal-doctest >=1.0.9 && <1.1
+
library
default-language: Haskell2010
exposed-modules: System.Random.MWC
@@ -141,7 +146,6 @@ test-suite mwc-doctests
buildable: False
build-depends:
base -any
- , mwc-random -any
, doctest >=0.15 && <0.24
--
, bytestring
--- a/tests/doctests.hs
+++ b/tests/doctests.hs
@@ -1,4 +1,9 @@
+import Build_doctests (flags, pkgs, module_sources)
import Test.DocTest (doctest)
+import GHC.IO.Encoding (setLocaleEncoding)
+import System.IO (utf8)
main :: IO ()
-main = doctest ["-fobject-code", "System/Random/MWC.hs"]
+main = do
+ setLocaleEncoding utf8
+ doctest $ flags ++ pkgs ++ module_sources
--
2.52.0
|