Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,357
    • Issues 5,357
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 566
    • Merge requests 566
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13002
Closed
Open
Issue created Dec 18, 2016 by george.colpitts@trac-george.colpitts

:set -O does not work in .ghci file

{-# OPTIONS_GHC -Wall #-}

module Foo where
        
testFromTo :: Int -> Int
testFromTo n = length ([0..(10^n)] :: [Int])
 cat ~/.ghci
:set +s
:set -fobject-code 
:set -O
bash-3.2$ touch Foo.hs
bash-3.2$ ghci
GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /Users/gcolpitts/.ghci
Prelude> :load Foo
:load Foo
[1 of 1] Compiling Foo              ( Foo.hs, Foo.o )
Ok, modules loaded: Foo (Foo.o).
(0.15 secs,)
Prelude Foo> testFromTo 5
testFromTo 5
100001
(0.02 secs, 8,885,888 bytes)
Prelude Foo> :quit
:quit
Leaving GHCi.
bash-3.2$ touch Foo.hs
bash-3.2$ ghci -fobject-code -O
GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /Users/gcolpitts/.ghci
Prelude> :load Foo
:load Foo
[1 of 1] Compiling Foo              ( Foo.hs, Foo.o )
Ok, modules loaded: Foo (Foo.o).
(0.15 secs,)
Prelude Foo> testFromTo 5
testFromTo 5
100001
(0.02 secs, 98,400 bytes)

While supplying -fobject-code -O as an argument to ghci seems like an easy workaround; it isn't feasible, as far as I know, when using emacs thus setting priority to normal rather than low.

Edited Mar 10, 2019 by george.colpitts
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking