Are explicit imports able to reduce the size of compiled files?

I will ask about utility. This concerns the effect on the size of the compiled executable / library. Not about code support or readability.

Import a specific module

Is it useful to import only the used module from the package instead of importing the main module (which itself imports the submodules).

For example, with a module Foreign(which contains only the import list):

import Foreign.Storable

instead:

import Foreign

Importing functions / types explicitly

Is it useful to import only used functions / types instead of importing the whole module?

For instance:

import Foreign.ForeignPtr (ForeignPtr, mallocForeignPtr, withForeignPtr)

instead:

import Foreign.ForeignPtr
+4
source share
1 answer

, , . , , , GHCI .

, , , , . (, , , Int, , [Int] , .) , , , .

, , , , , . , , , - .

, - , GHC 8, . .

, , , , . , .

+1
source

Source: https://habr.com/ru/post/1691542/


All Articles