on master help sign in
Fix a minor inconsistency between normal and foreign type signatures
commit43c6f4563428e871d760312ed1e414a51224c074 authormrkkrp <mark.karpov@tweag.io> dateSat 19 Oct 2019, 13:19 (7 years ago) parent73b03b1
2 files changed+10−6
data/examples/declaration/foreign/foreign-export-out.hs+2−1 src/Ormolu/Printer/Meat/Declaration/Foreign.hs+8−5
data/examples/declaration/foreign/foreign-export-out.hs+2−1
@@ -2,7 +2,8 @@ foreign export ccall foo :: Int -> IO Int
22
33-- | 'foreignTomFun' is a very important thing
44foreign export ccall "tomography"
5− foreignTomFun :: StablePtr Storage {- Storage is bad -} -> TomForegin
5+ foreignTomFun ::
6+ StablePtr Storage {- Storage is bad -} -> TomForegin
67
78foreign export {- We can't use capi here -} ccall "dynamic"
89 export_nullaryMeth :: (IO HRESULT) -> IO (Ptr ())
src/Ormolu/Printer/Meat/Declaration/Foreign.hs+8−5
@@ -32,11 +32,14 @@ p_foreignDecl = \case
3232p_foreignTypeSig :: ForeignDecl GhcPs -> R ()
3333p_foreignTypeSig fd = do
3434 breakpoint
35− -- Switch into the layout of the signature, to allow us to pull name and
36− -- signature onto a single line.
37− inci . switchLayout [getLoc . hsib_body $ fd_sig_ty fd] $ do
38− p_rdrName (fd_name fd)
39− p_typeAscription (HsWC NoExt (fd_sig_ty fd))
35+ inci
36+ . switchLayout
37+ [ getLoc (fd_name fd),
38+ (getLoc . hsib_body . fd_sig_ty) fd
39+ ]
40+ $ do
41+ p_rdrName (fd_name fd)
42+ p_typeAscription (HsWC NoExt (fd_sig_ty fd))
4043
4144-- | Printer for 'ForeignImport'.
4245--