Skip to content

Commit

Permalink
Better backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mmhat committed Aug 9, 2024
1 parent 56fb8cb commit 0fb94c9
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 111 deletions.
14 changes: 11 additions & 3 deletions os-string-compat/System/OsString/Compat/Include.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@
{-# OPTIONS_GHC -Wno-deprecations #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module System.OsString.Compat.PLATFORM_NAME
#define USE_os_string 0
#if defined MIN_VERSION_os_string
#if MIN_VERSION_os_string(2,0,0)
#undef USE_os_string
#define USE_os_string 1
#endif
#endif

module System.OsString.Compat.PLATFORM_NAME
#if USE_os_string
( PLATFORM_STRING(..)
, PLATFORM_CHAR(..)
, module OsString
Expand Down Expand Up @@ -47,7 +55,7 @@ import Data.Data (Data)
import System.OsString.Internal.Types (PLATFORM_STRING(..), PLATFORM_CHAR(..))
import System.OsString.PLATFORM_NAME as OsString

#if !MIN_VERSION_os_string(2,0,0)
#if !USE_os_string
import Data.Coerce (coerce)

#if IS_WINDOWS
Expand All @@ -59,7 +67,7 @@ import qualified System.OsPath.Data.ByteString.Short as BSP

deriving instance Data PLATFORM_STRING

#if !MIN_VERSION_os_string(2,0,0)
#if !USE_os_string
all :: (PLATFORM_CHAR -> Bool) -> PLATFORM_STRING -> Bool
all = coerce BSP.all

Expand Down
16 changes: 8 additions & 8 deletions path.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ flag dev
manual: True
default: False

flag old-os-string
flag os-string
description: Use an older version of the os-string library.
manual: False
default: False
Expand Down Expand Up @@ -78,10 +78,10 @@ library
, text
, template-haskell

if flag(old-os-string)
build-depends: filepath >= 1.4.100.0 && <1.5
else
if flag(os-string)
build-depends: filepath >= 1.5
else
build-depends: filepath >= 1.4.100.0 && <1.5

library os-string-compat
import: language
Expand All @@ -94,11 +94,11 @@ library os-string-compat

build-depends: base >= 4.12 && < 5

if flag(old-os-string)
build-depends: filepath >= 1.4.100.0
, os-string < 2.0.0
else
if flag(os-string)
build-depends: os-string >= 2.0.0
else
build-depends: filepath >= 1.4.100.0
-- , os-string < 2.0.0

test-suite test
import: language
Expand Down
13 changes: 0 additions & 13 deletions stack.old.yaml

This file was deleted.

54 changes: 0 additions & 54 deletions stack.old.yaml.lock

This file was deleted.

15 changes: 15 additions & 0 deletions stack.os-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resolver: lts-22.32 # GHC 9.6.6

extra-deps:
- directory-1.3.8.5@sha256:fbeec9ec346e5272167f63dcb86af513b457a7b9fc36dc818e4c7b81608d612b,3166
- filepath-1.5.3.0@sha256:0c64bc9a4f5946c86a8f0527bf40c8ba51e2c02d36eea0e20ea558c8d94166e8,4945
- process-1.6.20.0@sha256:2a9393de33f18415fb8f4826957a87a94ffe8840ca8472a9b69dca6de45aca03,2790
- unix-2.8.5.1@sha256:3f702a252a313a7bcb56e3908a14e7f9f1b40e41b7bdc8ae8a9605a1a8686f06,9808

flags:
directory:
os-string: true
path:
os-string: true
unix:
os-string: true
40 changes: 40 additions & 0 deletions stack.os-string.yaml.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files

packages:
- completed:
hackage: directory-1.3.8.5@sha256:fbeec9ec346e5272167f63dcb86af513b457a7b9fc36dc818e4c7b81608d612b,3166
pantry-tree:
sha256: d11130a0ca9e7c8720ed1ceef4e2f0d9be4b446e67e7d15d634763a5c952877e
size: 3519
original:
hackage: directory-1.3.8.5@sha256:fbeec9ec346e5272167f63dcb86af513b457a7b9fc36dc818e4c7b81608d612b,3166
- completed:
hackage: filepath-1.5.3.0@sha256:0c64bc9a4f5946c86a8f0527bf40c8ba51e2c02d36eea0e20ea558c8d94166e8,4945
pantry-tree:
sha256: a5feb33f17ff131a5bba009abae35761594d62ba6873b2f70992a48db160c9b7
size: 2274
original:
hackage: filepath-1.5.3.0@sha256:0c64bc9a4f5946c86a8f0527bf40c8ba51e2c02d36eea0e20ea558c8d94166e8,4945
- completed:
hackage: process-1.6.20.0@sha256:2a9393de33f18415fb8f4826957a87a94ffe8840ca8472a9b69dca6de45aca03,2790
pantry-tree:
sha256: 14d1e9a5ec731766e43c7eb9c2dc59a7da48d98d43374d9d83e725d8891c6173
size: 1789
original:
hackage: process-1.6.20.0@sha256:2a9393de33f18415fb8f4826957a87a94ffe8840ca8472a9b69dca6de45aca03,2790
- completed:
hackage: unix-2.8.5.1@sha256:3f702a252a313a7bcb56e3908a14e7f9f1b40e41b7bdc8ae8a9605a1a8686f06,9808
pantry-tree:
sha256: b961320db69795a16c4ef4eebb0a3e7ddbbbe506fa1e22dde95ee8d8501bfbe5
size: 5821
original:
hackage: unix-2.8.5.1@sha256:3f702a252a313a7bcb56e3908a14e7f9f1b40e41b7bdc8ae8a9605a1a8686f06,9808
snapshots:
- completed:
sha256: 417fa04a2ed8916cdae74c475ff97ac80857fed5000f19dce4f9564b5e635294
size: 720000
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/32.yaml
original: lts-22.32
19 changes: 6 additions & 13 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
resolver: lts-22.31 # GHC 9.6.6
resolver: lts-22.32 # GHC 9.6.6

extra-deps:
- directory-1.3.8.5@sha256:fbeec9ec346e5272167f63dcb86af513b457a7b9fc36dc818e4c7b81608d612b,3166
- filepath-1.5.3.0@sha256:0c64bc9a4f5946c86a8f0527bf40c8ba51e2c02d36eea0e20ea558c8d94166e8,4945
- process-1.6.20.0@sha256:2a9393de33f18415fb8f4826957a87a94ffe8840ca8472a9b69dca6de45aca03,2790
- unix-2.8.5.1@sha256:3f702a252a313a7bcb56e3908a14e7f9f1b40e41b7bdc8ae8a9605a1a8686f06,9808

flags:
directory:
os-string: true
path:
old-os-string: false
unix:
os-string: true
- data-fix-0.3.2
- hashable-1.4.3.0
- semialign-1.3
- text-short-0.1.5
- these-1.2
47 changes: 27 additions & 20 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,43 @@

packages:
- completed:
hackage: directory-1.3.8.5@sha256:fbeec9ec346e5272167f63dcb86af513b457a7b9fc36dc818e4c7b81608d612b,3166
hackage: data-fix-0.3.2@sha256:cd7d6ff8b68aca3b51d8116870fc8ccdbc557989562cd3d5c941e4f0b7bc5af1,1734
pantry-tree:
sha256: d11130a0ca9e7c8720ed1ceef4e2f0d9be4b446e67e7d15d634763a5c952877e
size: 3519
sha256: 39ea2bb3ace2b61bf72e7df77948f7fccc67c70d12a11e35dd20744eec5dd0bf
size: 262
original:
hackage: directory-1.3.8.5@sha256:fbeec9ec346e5272167f63dcb86af513b457a7b9fc36dc818e4c7b81608d612b,3166
hackage: data-fix-0.3.2
- completed:
hackage: filepath-1.5.3.0@sha256:0c64bc9a4f5946c86a8f0527bf40c8ba51e2c02d36eea0e20ea558c8d94166e8,4945
hackage: hashable-1.4.3.0@sha256:f3bf68acfa0df7a064a378ef2cdcfeb55e6fb96100675f4c593556dcbf3d7194,4718
pantry-tree:
sha256: a5feb33f17ff131a5bba009abae35761594d62ba6873b2f70992a48db160c9b7
size: 2274
sha256: abef0611d6a717ba351317bdb603ef536659e7767a49ba81b2dbe20994065c7d
size: 1248
original:
hackage: filepath-1.5.3.0@sha256:0c64bc9a4f5946c86a8f0527bf40c8ba51e2c02d36eea0e20ea558c8d94166e8,4945
hackage: hashable-1.4.3.0
- completed:
hackage: process-1.6.20.0@sha256:2a9393de33f18415fb8f4826957a87a94ffe8840ca8472a9b69dca6de45aca03,2790
hackage: semialign-1.3@sha256:7be9ef5ca1d6b052991f68c053aab68b9d1ab3b1938c9557ac84c97937815223,2888
pantry-tree:
sha256: 14d1e9a5ec731766e43c7eb9c2dc59a7da48d98d43374d9d83e725d8891c6173
size: 1789
sha256: e5daa7e0023dabb1b21a04bf084364b94e45e81b380e950b90f51294a1990b87
size: 537
original:
hackage: process-1.6.20.0@sha256:2a9393de33f18415fb8f4826957a87a94ffe8840ca8472a9b69dca6de45aca03,2790
hackage: semialign-1.3
- completed:
hackage: unix-2.8.5.1@sha256:3f702a252a313a7bcb56e3908a14e7f9f1b40e41b7bdc8ae8a9605a1a8686f06,9808
hackage: text-short-0.1.5@sha256:9c73c9c9182ca69ee92ce3758f515b1c078cd167d882ccc8c46f92f68c65e190,3216
pantry-tree:
sha256: b961320db69795a16c4ef4eebb0a3e7ddbbbe506fa1e22dde95ee8d8501bfbe5
size: 5821
sha256: d3dcfee9029cd3624a788a0e65f0dea588ae0446a8a75a27d6b6164b8ee0fd57
size: 727
original:
hackage: unix-2.8.5.1@sha256:3f702a252a313a7bcb56e3908a14e7f9f1b40e41b7bdc8ae8a9605a1a8686f06,9808
hackage: text-short-0.1.5
- completed:
hackage: these-1.2@sha256:011e22f6891ca028f87c04ea48796696c92d593313a9c699f7ff4f9ffd7aec6e,2882
pantry-tree:
sha256: 37483703ce7326c07608b06f2f741fb0f708cb06bd10ec57d87108d068046b05
size: 351
original:
hackage: these-1.2
snapshots:
- completed:
sha256: acaab6ca693211938d1542abcb1c83a2f298b9f6b571854a9d38febe39b6408e
size: 719577
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/31.yaml
original: lts-22.31
sha256: 417fa04a2ed8916cdae74c475ff97ac80857fed5000f19dce4f9564b5e635294
size: 720000
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/32.yaml
original: lts-22.32

0 comments on commit 0fb94c9

Please sign in to comment.