jagajaga / FP-Course-ITMO

Slides and other materials for functional programming lectures ITMO university

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The same name for module and constructor

Oktai15 opened this issue · comments

https://github.com/jagajaga/FP-Course-ITMO/blob/master/lecture-65-parser-combinators/test/Test/Property.hs

Line 6 and 12:

import Hedgehog (Gen, MonadTest, Property, assert, forAll, property, (===))
import qualified Hedgehog.Gen as Gen

We see the same name Gen -- as module and as constructor. It isn't error, but it is okay concerning haskell-style?

@Oktai15 It's completely okay. Type names and module qualifications are used in different places so compiler have no problems with it. Type like Gen is used often, so I don't want to write Gen.Gen instead of just Gen. But there're a lot of other functions from Hedgehog.Gen module which can have collisions. Every hedgehog tutorial and blog post imports Hedgehog.Gen in qualified manner. And personally I see a lot of sense in it.