I'm often in the habit of having a standard import block, so I have commonly used functionality at hand when I need it. For example,
-- license block
{-# LANGUAGE Arrows,
DeriveDataTypeable,
EmptyDataDecls,
FlexibleContexts,
FlexibleInstances,
FunctionalDependencies,
GADTs,
MultiParamTypeClasses,
NoMonomorphismRestriction,
RankNTypes,
ScopedTypeVariables,
StandaloneDeriving,
TypeOperators,
TypeSynonymInstances,
UndecidableInstances,
ViewPatterns #-}
module MyModule where
import Prelude hiding (id, (.))
import Control.Arrow
import Control.Category
import Control.Exception
import Control.Monad
import Control.Monad.ST
import Data.Array.Diff
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Data.Heap as Heap
import qualified Data.List as List
import qualified Data.List.Key as Key
import Data.List.HT
import Data.Maybe
import Data.STRef
import qualified Data.Text as T
Since I'm not using any fancy IDE's, I'd prefer not to read this in every file. Is there a way to create some kind of "standard" / "utility" module that re-exports the names of these functions, so I can just type,
import MyCommonFuncs
instead?
I know this is maybe not good practice, and maybe in theory one should add the minimial number of imports necessary, but as I said, I need to hack sometimes, and having fewer things to think about is always good.
EDIT -- more importantly, sometimes I want to change the block for all files, so the current system of importing everything individually can be tedious. Suppose, for example, that I need to remove the old import Time
and change this to the new [sic?] import System.Time
. Then, with the current system, I have to edit all files. Or, maybe I learn about a new language feature, and want that always available -- then I have to go manually update the older source files.