Name | Stars | Issues | Merge Requests | Status | Hackage |
---|---|---|---|---|---|
haskell-stack-trace-plugin |
Name | Stars | Issues | Merge Requests | Status | Hackage |
---|---|---|---|---|---|
hakyll-sass | - | ||||
sdl2-image | - | ||||
sdl2-mixer | - | ||||
missingh | - |
Name | Stars | Issues | Merge Requests | Status | Hackage |
---|---|---|---|---|---|
haskell-stack-trace-plugin |
Name | Stars | Issues | Merge Requests | Status | Hackage |
---|---|---|---|---|---|
hakyll-sass | - | ||||
sdl2-image | - | ||||
sdl2-mixer | - | ||||
missingh | - |
ghci> 1 + 0.1
<interactive>:1:5: error:
• Couldn't match expected type ‘Int’ with actual type ‘Double’
• In the second argument of ‘(+)’, namely ‘0.1’
In the expression: 1 + 0.1
In an equation for ‘it’: it = 1 + 0.1
期待する動作
ghci> 1 + 0.1
1.1
現在は Num
のクラスメソッドのみ :t
にするように分岐しているが、その他のメソッドも順次実装していく
ghci
で出力する型情報 (:t
を行った結果) について単体テストを行いたい。GHC-API
を使うdiff
とるデフォルトでは
-- Use [Integer, Double], plus modifications
default (Integer, Double)
となっている。変更しようとしても、そのあとの順番しか決めれないため GHC
いじるしかない。
(+) :: Num a => a -> a -> a
となるところを
(+) :: Num 数値型 => 数値型 -> 数値型 -> 数値型
という感じにしたい。
ghci> [0.1, 0.3 .. 1]
<interactive>:66:14: error:
• Couldn't match expected type ‘Double’ with actual type ‘Int’
• In the expression: 1
In the expression: [0.1, 0.3 .. 1]
In an equation for ‘it’: it = [0.1, 0.3 .. 1]
期待する動作
ghci> [0.1, 0.3 .. 1]
[0.1,0.3,0.5,0.7,0.8999999999999999,1.0999999999999999]
例えば以下のような感じ。
*EducationalPrelude> 1 == 'a'
<interactive>:13:1: error:
• No instance for (P.Num Char) arising from the literal ‘1’
• In the first argument of ‘(==)’, namely ‘1’
In the expression: 1 == 'a'
In an equation for ‘it’: it = 1 == 'a'
エラーメッセージを 型が合っていません
という感じのシンプルな内容に修正してしまえば良い気がしている。
ghci> :t (^)
Num a => a -> Int -> a
現状は以下のように表示される。
ghci> :t (^)
a -> Int -> a
Bool
型などはこれに当てはまらないが、クラス制約を非表示にしているため、このようになっている。
とりあえず MyPrelude を定義する
方向で進めることにした。
現在のところ基本型は以下の5種類と仮定する
Bool
Int
Double
[a]
(a, b)
このとき、Eq
, Ord
などのインスタンスにおいて問題が発生する。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.