Skip to content

Commit

Permalink
Move internal modules in finkel-core
Browse files Browse the repository at this point in the history
Add and export "Finkel.Core.Internal" module to the "finkel-core" package, move
internally used modules. Modify existing codes to follow the changes.
  • Loading branch information
8c6794b6 committed Jul 30, 2021
1 parent 040b2ed commit 117f81a
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 37 deletions.
17 changes: 9 additions & 8 deletions finkel-core/finkel-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ custom-setup

library
hs-source-dirs: src
exposed-modules: Paths_finkel_core
Finkel.Core
exposed-modules: Finkel.Core
Finkel.Core.Functions
Finkel.Core.Ghc
Finkel.Core.Ghc.Compat
Finkel.Core.Internal
Finkel.Prelude
other-modules: Finkel.Core.Stage0
Finkel.Core.Stage1
Finkel.Core.Stage2
Finkel.Core.Ghc.Version
Paths_finkel_core
other-modules: Finkel.Core.Internal.Stage0
Finkel.Core.Internal.Stage1
Finkel.Core.Internal.Stage2
Finkel.Core.Internal.Ghc
Finkel.Core.Internal.Ghc.Compat
Finkel.Core.Internal.Ghc.Version
autogen-modules: Paths_finkel_core
build-depends: base >= 4.7 && < 5
, ghc >= 8.2.0 && < 9.3
Expand Down
4 changes: 2 additions & 2 deletions finkel-core/src/Finkel/Core.fnk
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ default, i.e., available without /require/-ing the \"Finkel.Core\" module.")
case-do cond lcase lefn lept)

;; Internal
(import Finkel.Core.Stage1)
(import Finkel.Core.Stage2)
(import Finkel.Core.Internal.Stage1)
(import Finkel.Core.Internal.Stage2)
4 changes: 2 additions & 2 deletions finkel-core/src/Finkel/Core/Functions.fnk
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ with code values when writing macros.")
(FinkelListException ..) unsafeFinkelSrcError)

;; Internal
(import Finkel.Core.Stage0)
(import Finkel.Core.Stage2)
(import Finkel.Core.Internal.Stage0)
(import Finkel.Core.Internal.Stage2)

(:doc$ cxr "The `car' and `cdr' are the basic of /cxr/ functions.
Rest of the /cxr/ functions are composed from `car' and `cdr'.
Expand Down
6 changes: 0 additions & 6 deletions finkel-core/src/Finkel/Core/Ghc.fnk

This file was deleted.

12 changes: 12 additions & 0 deletions finkel-core/src/Finkel/Core/Internal.fnk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
;;;; For internal types and functions

(:doc "Module to re-export internal types and functions.

The intended usage is for internal use only, from test codes and from the
@finkel-tool@ package.")

(module Finkel.Core.Internal
(:dh1 "For GHC")
(module Finkel.Core.Internal.Ghc))

(import Finkel.Core.Internal.Ghc)
10 changes: 10 additions & 0 deletions finkel-core/src/Finkel/Core/Internal/Ghc.fnk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
;;;; Module for ghc related functions

(:doc "Internal module for @ghc@ related functions.")

(module Finkel.Core.Internal.Ghc
__glasgow_haskell__
(module Finkel.Core.Internal.Ghc.Compat))

(import Finkel.Core.Internal.Ghc.Compat)
(import Finkel.Core.Internal.Ghc.Version)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE CPP #-}
-- Module to re-export functions from ghc

module Finkel.Core.Ghc.Compat
module Finkel.Core.Internal.Ghc.Compat
(
-- GHC
getModuleInfo, lookupModule, lookupName, modInfoExports,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE CPP #-}
-- | Wrapper module to export version related functions.
module Finkel.Core.Ghc.Version
module Finkel.Core.Internal.Ghc.Version
( __glasgow_haskell__
, getPackageVersion
) where
Expand Down Expand Up @@ -32,7 +32,7 @@ import GHC.PackageDb (packageVersion)
#endif

-- Internal
import Finkel.Core.Ghc.Compat
import Finkel.Core.Internal.Ghc.Compat

-- | Function version of @__GLASGOW_HASKELL__@ C preprocessor macro.
__glasgow_haskell__ :: Int
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
;;;; Stage0 - functios usd in stage 1.

;;; This module contains few functions and type to work with `Code', just enough
;;; to define some macros in the next `Finkel.Core.Stage1' module.
;;; to define some macros in the next `Finkel.Core.Internal.Stage1' module.

(module Finkel.Core.Stage0
(module Finkel.Core.Internal.Stage0
;; Exported from other modules.
(FinkelListException ..) car cdr cons

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
;;; `defmodule', `eval-when', `macrolet' ... etc, just enough to start writing
;;; other macros and function in `Finkel.Core.Stage2'.

(module Finkel.Core.Stage1
(module Finkel.Core.Internal.Stage1
defmacro defmacro' defmacro-
defmacroM defmacroM' defmacroM-
macrolet macroletM
Expand All @@ -20,8 +20,8 @@
(import Language.Finkel)

;; Internal
(import Finkel.Core.Stage0)
(import Finkel.Core.Ghc.Compat)
(import Finkel.Core.Internal.Stage0)
(import Finkel.Core.Internal.Ghc.Compat)


;;; [Internally used macros]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
%p(LANGUAGE FlexibleInstances
TypeSynonymInstances)

(:require Finkel.Core.Stage1)
(:require Finkel.Core.Internal.Stage1)

(module Finkel.Core.Stage2
(module Finkel.Core.Internal.Stage2
;; Macros
defmodule
macroexpand macroexpand-1
Expand Down Expand Up @@ -53,9 +53,9 @@
(import Language.Finkel.Form (mkLocatedForm))

;; Internal
(import Finkel.Core.Stage0)
(import Finkel.Core.Ghc.Version)
(import Finkel.Core.Ghc.Compat)
(import Finkel.Core.Internal.Stage0)
(import Finkel.Core.Internal.Ghc.Version)
(import Finkel.Core.Internal.Ghc.Compat)


;;; ------------------------------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions finkel-core/test/CoreTest.fnk
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
;; finkel-core
(Finkel.Core)
(Finkel.Core.Functions [cadr])
(Finkel.Core.Ghc)
(Finkel.Core.Ghc.Compat)
(Finkel.Core.Internal)

;; Internal
(TestAux)))
Expand Down
2 changes: 1 addition & 1 deletion finkel-core/test/FunctionTest.fnk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
listTests)
(require
;; finkel-core
(Finkel.Core.Ghc))
(Finkel.Core.Internal))
(import
;; base
(Data.List [isSubsequenceOf])
Expand Down
2 changes: 1 addition & 1 deletion finkel-core/test/Orphan.fnk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
(Language.Finkel.Form)

;; finkel-core
(Finkel.Core.Ghc.Compat)))
(Finkel.Core.Internal)))

(instance (Arbitrary Atom)
(defn arbitrary
Expand Down
2 changes: 1 addition & 1 deletion finkel-core/test/TestAux.fnk
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

;; finkel-core
(Finkel.Prelude)
(Finkel.Core.Ghc.Compat)))
(Finkel.Core.Internal)))

;;; Types

Expand Down
2 changes: 1 addition & 1 deletion finkel-tool/src/Finkel/Tool/Internal/Macro/Ghc.fnk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

;; finkel-core
(Finkel.Prelude)
(Finkel.Core.Ghc [__glasgow_haskell__])))
(Finkel.Core.Internal [__glasgow_haskell__])))

;;; Module name aliases

Expand Down

0 comments on commit 117f81a

Please sign in to comment.