Skip to content

Commit

Permalink
Update shellac packages to compile on recent GHC
Browse files Browse the repository at this point in the history
  • Loading branch information
robdockins committed Oct 5, 2015
1 parent f855faa commit 745390b
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 66 deletions.
26 changes: 10 additions & 16 deletions Shellac.cabal
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Name: Shellac
Cabal-Version: >= 1.2
Cabal-Version: >= 1.22
Build-Type: Simple
Version: 0.9.5.1
Version: 0.9.9
License: BSD3
License-File: LICENSE
Author: Robert Dockins
Maintainer: robdockins AT fastmail DOT fm
Category: User Interfaces
Stability: Beta
Synopsis: A framework for creating shell envinronments
Homepage: http://www.cs.princeton.edu/~rdockins/shellac/home/
Homepage: http://rwd.rdockins.name/shellac/home/
Description:
Shellac is a framework for building read-eval-print style shells.
Shells are created by declaratively defining a set of shell commands
Expand All @@ -21,31 +21,25 @@ Description:
and still enjoy the advanced features that may be available from a
powerful line editing package like readline.

flag base4

Library
Hs-Source-Dirs: src
Build-Depends: base < 5, mtl, directory

if flag(base4)
Build-Depends: base >= 4
CPP-Options: -DBASE4
else
Build-Depends: base < 4

if impl(ghc >= 6.8) && impl(ghc < 6.10)
Extensions: PatternSignatures
Build-Depends:
base == 4.*,
mtl,
directory

if os(windows)
CPP-Options: -DBUILD_WINDOWS
else
Build-Depends: unix

Extensions:
Default-Language: Haskell2010
Default-Extensions:
MultiParamTypeClasses
FunctionalDependencies
ExistentialQuantification
CPP
ScopedTypeVariables
UndecidableInstances
GeneralizedNewtypeDeriving
FlexibleInstances
Expand Down
18 changes: 10 additions & 8 deletions shellac-compatline/Shellac-compatline.cabal
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Name: Shellac-compatline
Version: 0.9
Cabal-version: >= 1.2.2
Version: 0.9.9
Cabal-version: >= 1.22
Build-Type: Simple
Author: Robert Dockins
License: BSD3
License-File: LICENSE
Maintainer: robdockins AT fastmail DOT fm
Category: User Interfaces
Stability: Beta
Homepage: http://www.cs.princeton.edu/~rdockins/shellac/home/
Homepage: http://rwd.rdockins.name/shellac/home/
Synopsis: "compatline" backend module for Shellac
Description:
This package provides a Shellac backend which acts a thin interface
Expand All @@ -18,18 +18,18 @@ Description:

Flag UseEditline
Description: Use the Shellac-editline pacakge
Default: True
Default: False

Flag UseReadline
Description: Use the Shellac-readline package
Default: False
Default: True

Library
Hs-Source-Dirs:
src
Build-Depends:
base, haskell98,
Shellac >= 0.9
base == 4.*,
Shellac
if(flag(UseEditline))
Build-Depends: Shellac-editline
CPP-Options: -DUSE_EDITLINE
Expand All @@ -40,4 +40,6 @@ Library
Build-Depends: DependencyResolutionFailure > 999
Exposed-modules:
System.Console.Shell.Backend.Compatline
Extensions: CPP

Default-Language: Haskell2010
Default-Extensions: CPP
3 changes: 3 additions & 0 deletions shellac-editline/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env runhaskell
import Distribution.Simple
main = defaultMain
24 changes: 13 additions & 11 deletions shellac-editline/Shellac-editline.cabal
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Name: Shellac-editline
Version: 0.9.5
Cabal-version: >= 1.2
Version: 0.9.9
Cabal-version: >= 1.22
Build-type: Simple
Author: Robert Dockins
License: BSD3
License-File: LICENSE
Maintainer: robdockins AT fastmail DOT fm
Category: User Interfaces
Stability: Beta
Homepage: http://www.cs.princeton.edu/~rdockins/shellac/home/
Homepage: http://rwd.rdockins.name/shellac/home/
Synopsis: Editline backend module for Shellac
Description:
This package provides a Shellac backend based on the editline
Expand All @@ -17,11 +17,13 @@ Description:
with a BSD-style license and is therefore suitable for some situations
where GNU readline is not. This backend features all the line
editing capabilities provided by editline.
Hs-Source-Dirs:
src
Build-Depends:
base, haskell98,
editline >= 0.2.1,
Shellac >= 0.9
Exposed-modules:
System.Console.Shell.Backend.Editline

Library
Hs-Source-Dirs:
src
Build-Depends:
base == 4.*,
editline >= 0.2.1,
Shellac
Exposed-modules:
System.Console.Shell.Backend.Editline
3 changes: 3 additions & 0 deletions shellac-readline/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env runhaskell
import Distribution.Simple
main = defaultMain
23 changes: 13 additions & 10 deletions shellac-readline/Shellac-readline.cabal
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
Name: Shellac-readline
Version: 0.9
Version: 0.9.9
Cabal-Version: >= 1.22
License: BSD3
License-File: LICENSE
Author: Robert Dockins
Maintainer: robdockins AT fastmail DOT fm
Category: User Interfaces
Stability: Beta
Synopsis: Readline backend module for Shellac
Homepage: http://rwd.rdockins.name/shellac/home/
Description:
This package provides a Shellac backend based on the GNU readline
library. This backend features all the line editing capabilities
provided by readline, as well as command completion and command
history features.
Hs-Source-Dirs:

Library
Hs-Source-Dirs:
src
Build-Depends:
base >= 1.0,
haskell98 >= 1.0,
Build-Depends:
base == 4.*,
readline >= 1.0,
Shellac >= 0.9
Exposed-modules:
System.Console.Shell.Backend.Readline
Extensions:
ForeignFunctionInterface
Shellac
Exposed-modules:
System.Console.Shell.Backend.Readline
Extensions:
ForeignFunctionInterface
4 changes: 2 additions & 2 deletions shellac-readline/src/System/Console/Shell/Backend/Readline.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import System.IO ( stdin, stdout, stderr, hFlush, hPutStr, hPutStrLn,
, BufferMode(..)
)
import Foreign.Ptr ( Ptr )
import Foreign.C ( CInt, CString, withCString )
import Foreign.C.Error ( Errno, eOK, errnoToIOError )
import Foreign.C ( CInt(..), CString, withCString )
import Foreign.C.Error ( Errno(..), eOK, errnoToIOError )
import Foreign.Storable ( peek )

import qualified Control.Exception as Ex
Expand Down
1 change: 1 addition & 0 deletions src/System/Console/Shell/PPrint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module System.Console.Shell.PPrint
, displayS, displayIO
) where

import Prelude hiding ( (<|>), (<$>) )
import System.IO (Handle,hPutStr,hPutChar,stdout)

infixr 5 </>,<//>,<$>,<$$>
Expand Down
10 changes: 0 additions & 10 deletions src/System/Console/Shell/RunShell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -321,22 +321,12 @@ shellLoop desc backend iss = loop
-- ignores the thread killed exception, because that is used to
-- implement execution canceling)

#ifdef BASE4

defaultExceptionHandler :: ShellacException -> Sh st ()
defaultExceptionHandler ex =
case Ex.fromException ex of
Just Ex.ThreadKilled -> return ()
_ -> shellPutErrLn $ concat ["The following exception occurred:\n ",show ex]

#else

defaultExceptionHandler :: ShellacException -> Sh st ()
defaultExceptionHandler (Ex.AsyncException Ex.ThreadKilled) = return ()
defaultExceptionHandler ex = do
shellPutErrLn $ concat ["The following exception occurred:\n ",show ex]

#endif

----------------------------------------------------------------------------
-- | Creates a simple subshell from a state mapping function
Expand Down
10 changes: 1 addition & 9 deletions src/System/Console/Shell/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,7 @@ data CommandCompleter st
| UsernameCompleter
| OtherCompleter (st -> String -> IO [String])


#ifdef BASE4
-- | Compatability layer. For base-3, this is
-- \'Exception\'. For base-4, this is
-- \'SomeException\'.
type ShellacException = Ex.SomeException
#else
type ShellacException = Ex.Exception
#endif

-- | The result of parsing a command.
data CommandParseResult st
Expand Down Expand Up @@ -74,7 +66,7 @@ type OutputCommand = BackendOutput -> IO ()
-- The type parameter @st@ allows the monad to carry around a package of
-- user-defined state.
newtype Sh st a = Sh { unSh :: StateT (CommandResult st) (ReaderT OutputCommand IO) a }
deriving (Monad, MonadIO, MonadFix, Functor)
deriving (Monad, MonadIO, MonadFix, Functor, Applicative)

------------------------------------------------------------------------
-- The shell description and utility functions
Expand Down
7 changes: 7 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
packages:
- .
- shellac-readline
- shellac-compatline
extra-deps:
- readline-1.0.3.0
resolver: lts-3.3

0 comments on commit 745390b

Please sign in to comment.