Skip to content

Instantly share code, notes, and snippets.

@codedmart
Last active September 12, 2015 13:47
Show Gist options
  • Select an option

  • Save codedmart/d9eaf16d78893c15062d to your computer and use it in GitHub Desktop.

Select an option

Save codedmart/d9eaf16d78893c15062d to your computer and use it in GitHub Desktop.
module Models.Build (
Build(..)
) where
import Date exposing (Date(..))
import Models.Design exposing (Design(..))
import Models.User exposing (User(..))
type Build = Build
...
module Models.Design (
Design(..)
) where
import Date exposing (Date(..))
import Models.User exposing (User(..))
import Models.Build exposing (Build(..))
import Models.Image exposing (Image(..))
type Design = Design
...
module Models.Image (
Image(..)
) where
import Date exposing (Date(..))
import Models.Design exposing (Design(..))
type Image = Image
...
type alias Design =
{ ...
, image: Maybe Image
, ...
}
type alias Image =
{ ...
, design: Maybe Design
, ...
}
This type alias is part of a mutually recursive set of type aliases.
94|>type alias Design =
95|> { id: String
96|> , title: String
97|> , slug: String
98|> , vectorFileUrl: Maybe String
99|> , rasterFileUrl: Maybe String
100|> , size: Int
101|> , aspectRatio: AspectRatio
102|> , counts: Count
103|> , description: String
104|> , tags: Maybe (List String)
105|> , licenseType: Maybe String
106|> , private: Bool
107|> , nounProjectId: Maybe String
108|> , userId: Maybe String
109|> , user: Maybe User
110|> , image: Maybe Image
111|> --, builds: Maybe (List Build)
112|> --, favorites: Maybe (List Favorite)
113|> --, comments: Maybe (List Comment)
114|> --, orderItems: Maybe (List OrderItem)
115|> , createdAt: String
116|> , updatedAt: String
117|> , deletedAt: Maybe String
118|> }
The following type aliases all depend on each other in some way:
Design line 94
Image line 130
The problem is that when you try to expand any of these type aliases, they
expand infinitely! To fix, first try to centralize them into one alias.
module Models.User (
User(..)
) where
import Date exposing (Date(..))
type User = User
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment