3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GHCiを起動したときに、定義しておいた関数などを自動ロードする

Last updated at Posted at 2020-05-10
~/.ghci
:load ~/.ghci.hs
~/.ghci.hs
module Preset where

import Prelude

xs :: [Int]
xs = [1 .. 10]

GHCiを起動

>>> xs
[1,2,3,4,5,6,7,8,9,10]

やったね!

NOTICE

(グローバルプロジェクトでない)haskell-stackプロジェクト内で stack ghci すると、プロジェクト内のモジュールのみがロードされるので、手動で >>> import Preset してあげる必要があるようです。
(もちろん :module +Preset でもおっけー!)

なんで……?? 🤔

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?