You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the latest version of stylish-haskell to format a particular file inplace changes the content of the file, and when running stylish-haskell again on this file, it doesn't parse anymore. In other words, stylish-haskell breaks the idempotence property.
Here is the file:
{-# LANGUAGE CPP #-}
{-# LINE 2 "System/DiskSpace.hsc" #-}
{- |Module : System.DiskSpaceStability : provisionalPortability : portable-}moduleSystem.DiskSpace
( DiskUsage(..)
, getDiskUsage
) whereimportData.AesonimportForeignimportForeign.CimportGHC.GenericsimportForeign.C
{-# LINE 22 "System/DiskSpace.hsc" #-}
#ifndef mingw32_HOST_OS
foreignimport ccall safe statvfs ::CString->Ptra->IOCInt#elsestatvfs::CString->Ptra->IOCInt
statvfs =error"Don't use me on windows...."#endiftypeFsBlkCnt=Word64
{-# LINE 26 "System/DiskSpace.hsc" #-}
getDiskUsage path =
withCString path $\cPath ->
allocaBytes ((112)) $\stat ->do
{-# LINE 30 "System/DiskSpace.hsc" #-}
throwErrnoPathIfMinus1_ "getDiskUsage" path $ statvfs cPath stat
bsize <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) stat ::IOCULong
{-# LINE 32 "System/DiskSpace.hsc" #-}
frsize <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) stat ::IOCULong
{-# LINE 33 "System/DiskSpace.hsc" #-}
blocks <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) stat ::IOFsBlkCnt
{-# LINE 34 "System/DiskSpace.hsc" #-}
bfree <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) stat ::IOFsBlkCnt
{-# LINE 35 "System/DiskSpace.hsc" #-}
bavail <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) stat ::IOFsBlkCnt
{-# LINE 36 "System/DiskSpace.hsc" #-}
let frsize' =fromIntegral frsize
returnDiskUsage
{ diskTotal = frsize' *fromIntegral blocks
, diskFree = frsize' *fromIntegral bfree
, diskAvail = frsize' *fromIntegral bavail
, blockSize =fromIntegral bsize
}
{-# LINE 61 "System/DiskSpace.hsc" #-}
--| Disk usage information. All fields are in bytes.dataDiskUsage=DiskUsage{diskTotal::Integer--^ The total size of the file system.
, diskFree::Integer--^ The amount of free space. You probably want to-- use 'diskAvail' instead.
, diskAvail::Integer--^ The amount of space available to the user.-- Might be less than 'diskFree'. On Windows,-- this is always equal to 'diskFree'.-- This is what most tools report as free-- space (e.g. the unix @df@ tool).
, blockSize::Int--^ The optimal block size for I/O in this volume.-- Some operating systems report incorrect values-- for this field.}deriving (Show, Eq, Generic)
instanceToJSONDiskUsageinstanceFromJSONDiskUsage--| Retrieve disk usage information about a volume. The volume is-- specified with the @FilePath@ argument. The path can refer to the root-- directory or any other directory inside the volume.-- Unix systems also accept arbitrary files, but this-- does not work under Windows and therefore should be avoided if-- portability is desired.getDiskUsage::FilePath->IODiskUsage
After running stylish-haskell, the diff is the following:
--- src/System/DiskSpace.hs 2021-02-22 13:38:57.563807974 +0000+++ DiskSpaceNew.hs 2021-02-22 13:48:42.165595139 +0000@@ -12,7 +12,6 @@
( DiskUsage(..)
, getDiskUsage
) where
-
import Data.Aeson
import Foreign
import Foreign.C
@@ -62,14 +61,14 @@
data DiskUsage = DiskUsage
{ diskTotal :: Integer -- ^ The total size of the file system.
, diskFree :: Integer -- ^ The amount of free space. You probably want to
- -- use 'diskAvail' instead.+ -- use 'diskAvail' instead.
, diskAvail :: Integer -- ^ The amount of space available to the user.
- -- Might be less than 'diskFree'. On Windows,+ -- Might be less than 'diskFree'. On Windows,
-- this is always equal to 'diskFree'.
-- This is what most tools report as free
-- space (e.g. the unix @df@ tool).
, blockSize :: Int -- ^ The optimal block size for I/O in this volume.
- -- Some operating systems report incorrect values+ -- Some operating systems report incorrect values
-- for this field.
}
deriving (Show, Eq, Generic)
However, when I run stylish-haskell again, I see the following parse error:
Using the latest version of
stylish-haskell
to format a particular file inplace changes the content of the file, and when runningstylish-haskell
again on this file, it doesn't parse anymore. In other words,stylish-haskell
breaks the idempotence property.Here is the file:
After running
stylish-haskell
, the diff is the following:However, when I run
stylish-haskell
again, I see the following parse error:Stylish Haskell Version:
The text was updated successfully, but these errors were encountered: